Advertisement
Guest User

BackToThePast

a guest
Jul 21st, 2016
803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using System;
  2. class BackToThePast
  3. {
  4. static void Main()
  5. {
  6. double Heratage = double.Parse(Console.ReadLine());
  7. int year = int.Parse(Console.ReadLine());
  8.  
  9. for (int i = 1800; i <= year; i++)
  10. {
  11. if (i % 2 == 0)
  12. {
  13. Heratage = Heratage - 12000;
  14. }
  15. else
  16. {
  17. Heratage = Heratage - (12000 + (18 + (i - 1800)) * 50);
  18. }
  19. }
  20. if (Heratage > 0)
  21. {
  22. Console.WriteLine("Yes! He will live a carefree life and will have {0:f2} dollars left.", Heratage);
  23. }
  24. else
  25. {
  26. Console.WriteLine("He will need {0:f2} dollars to survive.", Math.Abs(Heratage));
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement