Advertisement
Sim0o0na

04. Cat Food

Jun 18th, 2018
1,879
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Practice
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int numOfCats = int.Parse(Console.ReadLine());
  14.  
  15.             int groupOne = 0;
  16.             int groupTwo = 0;
  17.             int groupThree = 0;
  18.             double totalFood = 0;
  19.  
  20.             for (int i = 1; i <= numOfCats; i++)
  21.             {
  22.                 double food = double.Parse(Console.ReadLine());
  23.                 totalFood += food;
  24.                 if (food >= 100 && food < 200)
  25.                 {
  26.                     groupOne++;
  27.                 }
  28.                 else if (food >= 200 && food < 300)
  29.                 {
  30.                     groupTwo++;
  31.                 }
  32.                 else if (food >= 300 && food < 400)
  33.                 {
  34.                     groupThree++;
  35.                 }
  36.             }
  37.  
  38.             Console.WriteLine($"Group 1: {groupOne} cats.");
  39.             Console.WriteLine($"Group 2: {groupTwo} cats.");
  40.             Console.WriteLine($"Group 3: {groupThree} cats.");
  41.             totalFood = Math.Round(((totalFood / 1000) * 12.45),2);
  42.             Console.WriteLine($"Price for food per day: {totalFood} lv.");
  43.  
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement