grach

2016_November_20M Pets

Dec 27th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var day = double.Parse(Console.ReadLine());
  14.             var foodKg = int.Parse(Console.ReadLine());
  15.             var dogFood = double.Parse(Console.ReadLine());
  16.             var catFood = double.Parse(Console.ReadLine());
  17.             var turtleFood = double.Parse(Console.ReadLine())/1000;
  18.  
  19.             var dog = day * dogFood;
  20.             var cat = day * catFood;
  21.             var turtle = day * (turtleFood);            
  22.  
  23.             var total = dog + cat + turtle;
  24.  
  25.             if (total<=foodKg)
  26.  
  27.             {
  28.                 Console.WriteLine($"{Math.Floor(foodKg-total)} kilos of food left.");
  29.             }
  30.  
  31.             else
  32.                 Console.WriteLine($"{Math.Ceiling(total-foodKg)} more kilos of food are needed.");            
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment