daily pastebin goal
37%
SHARE
TWEET

Untitled

Cwetomirrrr Dec 16th, 2018 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top