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