Advertisement
Somo4k

04.Cat-Food

Jun 10th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _04._Cat_FOOD
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int n = int.Parse(Console.ReadLine());
  10. int group1 = 0;
  11. int group2 = 0;
  12. int group3 = 0;
  13. double sumFood = 0;
  14.  
  15. for (int i = 0; i < n; i++)
  16. {
  17. double gramsFood = double.Parse(Console.ReadLine());
  18. sumFood += gramsFood;
  19.  
  20. if (gramsFood >= 100 && gramsFood < 200)
  21. {
  22. group1++;
  23. }
  24. else if (gramsFood >= 200 && gramsFood < 300)
  25. {
  26. group2++;
  27. }
  28. else if (gramsFood >= 300 && gramsFood < 400)
  29. {
  30. group3++;
  31. }
  32. }
  33. sumFood = (sumFood / 1000) * 12.45;
  34. Console.WriteLine($"Group 1: {group1} cats.");
  35. Console.WriteLine($"Group 2: {group2} cats.");
  36. Console.WriteLine($"Group 3: {group3} cats.");
  37. Console.WriteLine($"Price for food per day: {sumFood:F2} lv.");
  38. }
  39. }
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement