Guest User

Untitled

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