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