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