Advertisement
dsavov_02

kotki

Dec 9th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int days = int.Parse(Console.ReadLine());
  8.         int kilos = int.Parse(Console.ReadLine());
  9.         double dailyF1 = double.Parse(Console.ReadLine());
  10.         double dailyF2 = double.Parse(Console.ReadLine());
  11.         double cat1 = dailyF1 * days;
  12.         double cat2 = dailyF2 * days;
  13.         double allfood = cat1 + cat2;
  14.         if(allfood <= kilos)
  15.            
  16.         {
  17.            
  18.             Console.WriteLine("The cats are well fed.");
  19.             Console.WriteLine("{0} kilos of food left.", Math.Ceiling(kilos - allfood));
  20.            
  21.         }
  22.        
  23.         else
  24.            
  25.         {
  26.            
  27.             Console.WriteLine("The cats are hungry.");
  28.             Console.WriteLine("{0} more kilos of food are needed.", Math.Floor(allfood - kilos));
  29.        
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement