Advertisement
Cwetomirrrr

Untitled

Dec 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _04_PuppyCare
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int eatInKilos = int.Parse(Console.ReadLine());
  14. int eatInGrams = eatInKilos * 1000;
  15. string porcion = string.Empty;
  16. int eatedFood = 0;
  17.  
  18. while (true)
  19. {
  20. porcion = Console.ReadLine();
  21.  
  22. if (porcion == "Adopted")
  23. {
  24. break;
  25. }
  26. eatedFood += int.Parse(porcion);
  27. }
  28. int leftEat = Math.Abs(eatInGrams - eatedFood);
  29.  
  30. if (eatInGrams >= eatedFood)
  31. {
  32. Console.WriteLine($"Food is enough! Leftovers: {leftEat} grams.");
  33. }
  34. else
  35. {
  36. Console.WriteLine($"Food is not enough. You need {leftEat} grams more.");
  37. }
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement