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