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)
- {
- double days = double.Parse(Console.ReadLine());
- double countFood = double.Parse(Console.ReadLine());
- double dogFood = 0;
- double catFood = 0;
- double biscuits = 0;
- double countAllFood = 0;
- for (int i = 1; i <= days; i++)
- {
- double dogFoodPerDay = double.Parse(Console.ReadLine());
- double catFoodPerDay = double.Parse(Console.ReadLine());
- dogFood += dogFoodPerDay;
- catFood += catFoodPerDay;
- countAllFood = (dogFood + catFood);
- if (days % 3 == 0)
- {
- biscuits = (dogFoodPerDay + catFoodPerDay) * 0.1;
- }
- }
- Console.WriteLine($"Total eaten biscuits: {Math.Ceiling(biscuits)}gr.");
- Console.WriteLine($"{(countAllFood / countFood) * 100:f2}% of the food has been eaten.");
- Console.WriteLine($"{((dogFood / countAllFood) * 100)}% eaten from the dog.");
- Console.WriteLine($"{(catFood / countAllFood) * 100:f2}% eaten from the cat.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment