drunin89

Pets

Nov 24th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Pets
  8. {
  9.     class Pets
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int days = int.Parse(Console.ReadLine());
  14.             int food = int.Parse(Console.ReadLine());
  15.             double dogFood = double.Parse(Console.ReadLine());
  16.             double catFood = double.Parse(Console.ReadLine());
  17.             double turtleFood = double.Parse(Console.ReadLine());
  18.             double dogF = dogFood * days;
  19.             double catF = catFood * days;
  20.             double turtleF = turtleFood / 1000 * days;
  21.             double totalFood = dogF + catF + turtleF;
  22.             if (totalFood <= food)
  23.             {
  24.                 Console.WriteLine("{0} kilos of food left.", Math.Floor(food - totalFood));
  25.  
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine("{0} more kilos of food are needed.", Math.Ceiling(totalFood - food));
  30.             }
  31.  
  32.         }
  33.     }
  34. }
Add Comment
Please, Sign In to add comment