Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Practice
- {
- class Program
- {
- static void Main(string[] args)
- {
- int kgOfFood = int.Parse(Console.ReadLine());
- kgOfFood = kgOfFood * 1000;
- double food = 0;
- while (true)
- {
- string command = Console.ReadLine();
- if (command == "Adopted")
- {
- break;
- }
- else
- {
- food += int.Parse(command);
- }
- }
- if (kgOfFood >= food)
- {
- Console.WriteLine($"Food is enough! Leftovers: {kgOfFood - food} grams.");
- }
- else
- {
- Console.WriteLine($"Food is not enough. You need {food - kgOfFood} grams more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement