Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05._PUPPYCare
- {
- class Program
- {
- static void Main(string[] args)
- {
- int kg = int.Parse(Console.ReadLine());
- string gramsFood = Console.ReadLine();
- int sumFood = 0;
- int grams = kg * 1000;
- while (gramsFood != "Adopted")
- {
- int num = int.Parse(gramsFood);
- sumFood += num;
- gramsFood = Console.ReadLine();
- }
- if (sumFood > grams)
- {
- Console.WriteLine($"Food is not enough. You need {sumFood - grams} grams more.");
- }
- else
- {
- Console.WriteLine($"Food is enough! Leftovers: {grams - sumFood} grams.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement