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