Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _04._Food_for_Pets
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- double availableFood = double.Parse(Console.ReadLine());
- double totalDog = 0;
- double totalCat = 0;
- double total = 0;
- double totalBiscuits = 0;
- for (int day = 1; day <= days; day++)
- {
- int dog = int.Parse(Console.ReadLine());
- int cat = int.Parse(Console.ReadLine());
- totalDog += dog;
- totalCat += cat;
- total += dog + cat;
- if (day % 3 == 0)
- {
- totalBiscuits += 0.10 * (dog + cat);
- }
- }
- Console.WriteLine($"Total eaten biscuits: {Math.Round(totalBiscuits)}gr.");
- double percentEaten = total / availableFood * 100;
- Console.WriteLine($"{percentEaten:f2}% of the food has been eaten.");
- double percentByDog = totalDog / total * 100;
- Console.WriteLine($"{percentByDog:f2}% eaten from the dog.");
- double percentByCat = totalCat / total * 100;
- Console.WriteLine($"{percentByCat:f2}% eaten from the cat.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement