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