Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
95
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 Easter_Guests
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double numberOfGuests = double.Parse(Console.ReadLine());
  14.             double budget = double.Parse(Console.ReadLine());
  15.  
  16.             double numberOfEasterBread = Math.Ceiling(numberOfGuests / 3);
  17.             double numberOfEggs = numberOfGuests * 2;
  18.             double priceOfEasterBread = numberOfEasterBread * 4;
  19.             double priceOfEggs = numberOfEggs * 0.45;
  20.             double totalPrice = priceOfEasterBread + priceOfEggs;
  21.             double moneyLeft = budget - totalPrice;
  22.  
  23.             if(budget >= totalPrice)
  24.             {
  25.                 Console.WriteLine($"Lyubo bought {numberOfEasterBread} Easter bread and {numberOfEggs} eggs.");
  26.                 Console.WriteLine($"He has {moneyLeft:F2} lv. left.");
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement