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