Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DisneylandJourney
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- double costOfJourney = double.Parse(Console.ReadLine());
- int month = int.Parse(Console.ReadLine());
- double savedMoney = 0;
- for (int i = 1; i <=month; i++)
- {
- if(i%2!=0 && i!=1)
- {
- savedMoney -= 0.16 * savedMoney;
- }
- else if (i % 4 == 0)
- {
- savedMoney += 0.25 * savedMoney;
- }
- savedMoney += 0.25 * costOfJourney;
- }
- if (savedMoney >= costOfJourney)
- {
- Console.WriteLine($"Bravo! You can go to Disneyland and you will have {savedMoney - costOfJourney:F2}lv. for souvenirs.");
- }
- else
- {
- Console.WriteLine($"Sorry. You need {costOfJourney-savedMoney:F2}lv. more.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement