Advertisement
NedyalkoKikov

SweetDesert

Jun 11th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 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 SweetDesert
  8. {
  9. class SweetDesert
  10. {
  11. static void Main()
  12. {
  13. decimal amountOFCash = decimal.Parse(Console.ReadLine());
  14. decimal numberOFGuest = decimal.Parse(Console.ReadLine());
  15. decimal bananaPrice = decimal.Parse(Console.ReadLine());
  16. decimal eggsPrice = decimal.Parse(Console.ReadLine());
  17. decimal berriesKilo = decimal.Parse(Console.ReadLine());
  18. decimal sets =Math.Ceiling(numberOFGuest / 6);
  19. decimal result = sets * (2 * bananaPrice) + sets * (4 * eggsPrice) + sets * (0.2M * berriesKilo);
  20. if(result <= amountOFCash)
  21. {
  22. Console.WriteLine("Ivancho has enough money - it would cost {0:F2}lv.",result);
  23. }
  24. else
  25. {
  26. decimal moremoney = result - amountOFCash;
  27. Console.WriteLine("Ivancho will have to withdraw money - he will need {0:F2}lv more.",moremoney);
  28. }
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement