VickSuna

Untitled

Feb 18th, 2020
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _336_Pets
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int absentDays = int.Parse(Console.ReadLine());
  10. int leftFoodinKGs = int.Parse(Console.ReadLine());
  11. double foodDogForDay = double.Parse(Console.ReadLine());
  12. double foodCatForDay = double.Parse(Console.ReadLine());
  13. double foodTurtleForDay = double.Parse(Console.ReadLine());
  14.  
  15. double neededFood = ((absentDays * foodDogForDay) + (absentDays * foodCatForDay) + (absentDays * foodTurtleForDay /1000));
  16. // Console.WriteLine(neededFood);
  17. if (leftFoodinKGs >= neededFood)
  18. {
  19. double razlika = Math.Floor(leftFoodinKGs - neededFood);
  20. Console.WriteLine($"{razlika} kilos of food left.");
  21. }
  22. else if (leftFoodinKGs < neededFood)
  23. {
  24. double razlika = Math.Ceiling(neededFood - leftFoodinKGs);
  25. Console.WriteLine($"{razlika} more kilos of food are needed.");
  26.  
  27. }
  28.  
  29.  
  30. }
  31. }
  32. }
Add Comment
Please, Sign In to add comment