Advertisement
sivancheva

SweetDesert

Sep 12th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 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 _01_SweetDesert
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. decimal cash = decimal.Parse(Console.ReadLine());
  14. decimal guests = decimal.Parse(Console.ReadLine());
  15. decimal bananasPrice = decimal.Parse(Console.ReadLine());
  16. decimal eggsPrice = decimal.Parse(Console.ReadLine());
  17. decimal berryPrice = decimal.Parse(Console.ReadLine());
  18.  
  19.  
  20. var broiPorcii = Math.Ceiling(guests / 6);
  21. var priceAllDeserts = broiPorcii * (2 * bananasPrice + 4 * eggsPrice + 0.2m * berryPrice);
  22.  
  23. if (priceAllDeserts <= cash)
  24. {
  25. Console.WriteLine($"Ivancho has enough money - it would cost {priceAllDeserts:F2}lv.");
  26. }
  27. else
  28. {
  29. Console.WriteLine($"Ivancho will have to withdraw money - he will need {(priceAllDeserts-cash):F2}lv more.");
  30. }
  31.  
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement