Advertisement
AngelVasilev

SoftUni Fundamentals - Disneyland Journey

Feb 25th, 2020
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Disneyland_Journey
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double cost = double.Parse(Console.ReadLine());
  10. int months = int.Parse(Console.ReadLine());
  11.  
  12. double savedMoney = 0;
  13.  
  14. for (int i = 1; i <= months; i++)
  15. {
  16.  
  17. if (i % 2 == 1 && i > 1)
  18. {
  19. savedMoney = savedMoney - (savedMoney * 0.16);
  20. }
  21.  
  22. if (i % 4 == 0)
  23. {
  24. savedMoney = savedMoney + (savedMoney * 0.25);
  25. }
  26.  
  27. savedMoney += cost * 0.25;
  28. }
  29.  
  30. if (savedMoney >= cost)
  31. {
  32. double souvenierMoney = savedMoney - cost;
  33.  
  34. Console.WriteLine($"Bravo! You can go to Disneyland and you will have {souvenierMoney:F2}lv. for souvenirs.");
  35. }
  36. else
  37. {
  38. double neededMoney = cost - savedMoney;
  39.  
  40. Console.WriteLine($"Sorry. You need {neededMoney:F2}lv. more.");
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement