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 Back_To_The_Past
- {
- class Program
- {
- static void Main(string[] args)
- {
- double legacyMoney = double.Parse(Console.ReadLine());
- int lastYear = int.Parse(Console.ReadLine());
- int livingYears = lastYear - 1800;
- var difference = legacyMoney;
- for (int firstYear = 0; firstYear <= livingYears; firstYear++)
- {
- if (firstYear % 2 == 0) // Triabva da napravia proverka za chetna i nechetna data
- {
- difference -= 12000;
- }
- else
- {
- difference -= (12000 + (50* (18 + firstYear)));
- }
- }
- if (difference >= 0)
- {
- Console.WriteLine("Yes! He will live a carefree life and will have {0:f2} dollars left.", Math.Abs(difference));
- }
- else
- {
- Console.WriteLine("He will need {0:f2} dollars to survive.", Math.Abs(difference));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment