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 BackToThePast
- {
- static void Main(string[] args)
- {
- var money = double.Parse(Console.ReadLine());
- var year = int.Parse(Console.ReadLine());
- double result = money;
- for (int i = 1800; i <= year; i+=2)
- {
- result -= 12000;
- }
- for (int i = 1801; i <= year; i+=2)
- {
- result -= (12000 + (50 * (i - 1800 + 18)));
- }
- if (result >= 0)
- {
- Console.WriteLine("Yes! He will live a carefree life and will have {0:F2} dollars left.", result);
- }
- else if (result < 0)
- {
- Console.WriteLine("He will need {0:F2} dollars to survive.", Math.Abs(result));
- }
- else
- {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement