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