Advertisement
Sim0o0na

Untitled

Feb 3rd, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace BackToThePast
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double inheritedMoney = double.Parse(Console.ReadLine());
  14. int year = int.Parse(Console.ReadLine());
  15.  
  16. int years = 18;
  17.  
  18. for(int i = 1800; i<=year; i++)
  19. {
  20. if (i % 2 == 0)
  21. {
  22. inheritedMoney -= 12000;
  23. }else
  24. {
  25. inheritedMoney -= 12000 + (50 * years);
  26. }
  27. years++;
  28. }
  29.  
  30. if (inheritedMoney >= 0)
  31. {
  32. Console.WriteLine("Yes! He will live a carefree life and will have {0:0.00} dollars left.", inheritedMoney);
  33. }else
  34. {
  35. Console.WriteLine("He will need {0:0.00} dollars to survive.", Math.Abs(inheritedMoney));
  36. }
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement