petarkobakov

Disneyland Journey

Jul 1st, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 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. int price = int.Parse(Console.ReadLine());
  10. int monthsForSaving = int.Parse(Console.ReadLine());
  11.  
  12. double monthlySavings = 0;
  13.  
  14. for (int i = 1; i <= monthsForSaving; i++)
  15. {
  16.  
  17.  
  18. if ((i % 3) == 0)
  19. {
  20. monthlySavings -= monthlySavings * 0.16;
  21.  
  22.  
  23. }
  24. if ((i % 4) == 0)
  25. {
  26. double bonus = monthlySavings * 0.25;
  27. monthlySavings += bonus;
  28. }
  29.  
  30. monthlySavings += price * 0.25;
  31.  
  32. }
  33. if (monthlySavings >= price)
  34. {
  35. double moneyForSouvenirs = monthlySavings - price;
  36. Console.WriteLine($"Bravo! You can go to Disneyland and you will have {(moneyForSouvenirs):f2}lv. for souvenirs.");
  37. }
  38. else
  39. {
  40. Console.WriteLine($"Sorry. You need {(price - monthlySavings):f2}lv. more.");
  41. }
  42. }
  43. }
  44. }
Add Comment
Please, Sign In to add comment