Advertisement
YavorJS

Sweet Dessert 100%

Sep 13th, 2016
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 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 _1.Sweet_Dessert
  8. {
  9. class Program
  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. int sets = 0;
  20. if (guests > 0)
  21. {
  22. sets = 1;
  23. while (guests > 6)
  24. {
  25. sets++;
  26. guests = guests - 6;
  27. }
  28. }
  29.  
  30. decimal priceOfSet = 2 * bananasPrice + 4 * eggsPrice + 0.2m * berriesPrice;
  31. decimal totalPrice = sets * priceOfSet;
  32.  
  33. if (cash >= totalPrice)
  34. {
  35. Console.WriteLine("Ivancho has enough money - it would cost {0:f2}lv.", totalPrice);
  36. }
  37. else
  38. {
  39. Console.WriteLine("Ivancho will have to withdraw money - he will need {0:f2}lv more.", totalPrice - cash);
  40. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement