Advertisement
Spocoman

Easter Guests

Nov 27th, 2021
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace EasterGuests
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double guest = int.Parse(Console.ReadLine());
  10.             double budget = double.Parse(Console.ReadLine());
  11.  
  12.             double sum = Math.Ceiling(guest / 3) * 4 + guest * 2 * 0.45;
  13.  
  14.             if (budget >= sum)
  15.             {
  16.                 Console.WriteLine($"Lyubo bought {Math.Ceiling(guest / 3)} Easter bread and {guest * 2} eggs.");
  17.                 Console.WriteLine($"He has {budget - sum:F2} lv. left.");
  18.             }
  19.             else
  20.             {
  21.                 Console.WriteLine("Lyubo doesn't have enough money.");
  22.                 Console.WriteLine($"He needs {sum - budget:F2} lv. more.");
  23.             }
  24.         }
  25.     }
  26. }
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement