Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Pets
- {
- class Pets
- {
- static void Main(string[] args)
- {
- int day = int.Parse(Console.ReadLine());
- int leftFood = int.Parse(Console.ReadLine()); //kg
- double foodForDog = double.Parse(Console.ReadLine()); //kg
- double foodForCat = double.Parse(Console.ReadLine()); //kg
- double foodForTurtle = double.Parse(Console.ReadLine()); //gram
- double neededFoodsForDog = day * foodForDog;
- double neededFoodsForCat = day * foodForCat;
- double neededFoodsForTurtle = day * foodForTurtle / 1000;
- double sumFoodForAnimal = neededFoodsForDog + neededFoodsForCat + neededFoodsForTurtle;
- double result = Math.Abs(leftFood - sumFoodForAnimal);
- if (sumFoodForAnimal <= (double)leftFood) Console.WriteLine($"{Math.Floor(result)} kilos of food left.");
- else Console.WriteLine($"{Math.Ceiling(result)} more kilos of food are needed.");
- }
- }
- }
Add Comment
Please, Sign In to add comment