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