Advertisement
Spocoman

Cat Shelter

Jan 9th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CatShelter
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int food = int.Parse(Console.ReadLine()) * 1000;
  10.             string command = Console.ReadLine();
  11.             while (command != "Adopted")
  12.             {
  13.                 food -= int.Parse(command);
  14.                 command = Console.ReadLine();
  15.             }
  16.             if (food >= 0)
  17.             {
  18.                 Console.WriteLine($"Food is enough! Leftovers: {food} grams.");
  19.             }
  20.             else
  21.             {
  22.                 Console.WriteLine($"Food is not enough. You need {Math.Abs(food)} grams more.");
  23.             }
  24.  
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement