Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BAck_to_the_PAst
- {
- class Program
- {
- static void Main(string[] args)
- {
- //вход от конзолта наследствени пари ->
- double heritage = double.Parse(Console.ReadLine());
- int year = int.Parse(Console.ReadLine());
- int difference = year-1800;
- int age = 18;
- //гонината до която ще живее вкл.
- for (int i = 0; i <= difference; i++)
- {
- // ако е четна ще харчи 12 000лв.
- if (i% 2 ==0)
- {
- heritage = heritage -12000;
- }
- // ако е нечетна ще харчи 12 000 + 50-> по годините които е навършил през дадената година
- else
- {
- heritage = heritage - (12000+ (50 *age));
- }
- age++;
- }
- age++;
- if (heritage >=0)
- {
- Console.WriteLine("Yes! He will live a carefree life and will have {0:f2} dollars left.",heritage);
- }
- else
- {
- Console.WriteLine("He will need {0:f2} dollars to survive.",Math.Abs (heritage));
- }
- // дали парите които има ще стигнат за да живее
- }
- }
- }
Add Comment
Please, Sign In to add comment