Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BackToThePast
- {
- class Program
- {
- static void Main(string[] args)
- {
- double money = double.Parse(Console.ReadLine());
- int year = int.Parse(Console.ReadLine());
- int ivanchoEge = 18;
- for (int i = 1800; i <= year; i++)
- {
- if (i % 2 == 0)
- {
- money -= 12000;
- }
- else
- {
- money -= 12000 + 50 * ivanchoEge;
- }
- ivanchoEge++;
- }
- if (money >= 0)
- {
- Console.WriteLine($"Yes! He will live a carefree life and will have { money:f2} dollars left.");
- }
- else
- {
- Console.WriteLine($"He will need { Math.Abs(money):f2} dollars to survive.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment