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