Advertisement
Spocoman

Deer of Santa

Nov 25th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2.  
  3. namespace DeerOfSanta
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int days = int.Parse(Console.ReadLine());
  10.             double foods = double.Parse(Console.ReadLine());
  11.             double deer1 = double.Parse(Console.ReadLine());
  12.             double deer2 = double.Parse(Console.ReadLine());
  13.             double deer3 = double.Parse(Console.ReadLine());
  14.  
  15.             double neededFood = (deer1 + deer2 + deer3) * days;
  16.  
  17.             if (foods >= neededFood)
  18.             {
  19.                 Console.WriteLine($"{Math.Floor(foods - neededFood)} kilos of food left.");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine($"{Math.Ceiling(neededFood - foods)} more kilos of food are needed.");
  24.             }
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement