Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace FoodForPets
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- double food = double.Parse(Console.ReadLine());
- int dogsFood = 0;
- int catsFood = 0;
- double cookies = 0;
- for (int i = 1; i <= days; i++)
- {
- int dayFoodForDog = int.Parse(Console.ReadLine());
- int dayFoodForCat = int.Parse(Console.ReadLine());
- if (i % 3 == 0)
- {
- cookies += (double)(dayFoodForDog + dayFoodForCat) / 10;
- }
- dogsFood += dayFoodForDog;
- catsFood += dayFoodForCat;
- }
- double totalFood = dogsFood + catsFood;
- Console.WriteLine($"Total eaten biscuits: {Math.Round(cookies)}gr.");
- Console.WriteLine($"{totalFood / food * 100:f2}% of the food has been eaten.");
- Console.WriteLine($"{dogsFood / totalFood * 100:f2}% eaten from the dog.");
- Console.WriteLine($"{catsFood / totalFood * 100:f2}% eaten from the cat.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement