Advertisement
YORDAN2347

04

Feb 21st, 2021
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int catsCount = int.Parse(Console.ReadLine());
  10.  
  11.             int smallCats = 0;
  12.             int mediumCats = 0;
  13.             int bigCats = 0;
  14.  
  15.             double foodSum = 0;
  16.  
  17.             for (int i = 0; i < catsCount; i++)
  18.             {
  19.                 int currFood = int.Parse(Console.ReadLine());
  20.                 foodSum += currFood;
  21.                 if (currFood >= 100 && currFood < 200)
  22.                 {
  23.                     smallCats++;
  24.                 }
  25.                 else if(currFood >= 200 && currFood < 300)
  26.                 {
  27.                     mediumCats++;
  28.                 }
  29.                 else if(currFood >= 300 && currFood < 400)
  30.                 {
  31.                     bigCats++;
  32.                 }
  33.             }
  34.            
  35.             foodSum /= 1000;
  36.             double priceSum = foodSum * 12.45;
  37.  
  38.             Console.WriteLine($"Group 1: {smallCats} cats.");
  39.             Console.WriteLine($"Group 2: {mediumCats} cats.");
  40.             Console.WriteLine($"Group 3: {bigCats} cats.");
  41.             Console.WriteLine($"Price for food per day: {priceSum:f2} lv.");
  42.         }
  43.     }
  44. }
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement