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