Advertisement
Guest User

Untitled

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