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