Advertisement
Guest User

Untitled

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