Advertisement
Spocoman

Sweet Dessert

Oct 1st, 2023
904
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SweetDessert
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             int guests = int.Parse(Console.ReadLine());
  11.             double bananaPrice = double.Parse(Console.ReadLine());
  12.             double eggPrice = double.Parse(Console.ReadLine());
  13.             double berriesKiloPrice = double.Parse(Console.ReadLine());
  14.  
  15.             double neededMoney = Math.Ceiling((double)guests / 6) * (bananaPrice * 2 + eggPrice * 4 + berriesKiloPrice / 5);
  16.            
  17.             if(budget >= neededMoney)
  18.             {
  19.                 Console.WriteLine($"Ivancho has enough money - it would cost {neededMoney:f2}lv.");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine($"Ivancho will have to withdraw money - he will need {neededMoney - budget:f2}lv more.");
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement