Advertisement
plamen27

Back to Past

Jul 18th, 2016
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 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 _0_4_zad
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double money = double.Parse(Console.ReadLine());
  14. int year = int.Parse(Console.ReadLine());
  15. int count = 0;
  16. for (int i = 1800; i <= year; i++)
  17. {
  18. if (i % 2 == 0)
  19. { money = money - 12000;}
  20.  
  21. else if (i % 2 != 0)
  22. { money = money - (12000 + (50 * (18+count)));}
  23. count++;
  24. }
  25. if (money >= 0)
  26. {
  27. Console.WriteLine("Yes! He will live a carefree life and will have {0:F2} dollars left.", money);
  28. }
  29. else
  30. {
  31. Console.WriteLine("He will need {0:F2} dollars to survive.", Math.Abs(money));
  32. }
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement