Advertisement
terlichki

Untitled

Feb 25th, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. <?php
  2.  
  3. $money = floatval(readline());
  4. $year = intval(readline());
  5. $ComplatedYears=19;
  6.  
  7. for ($i = 1800; $i <= $year; $i++) {
  8. if ($i % 2 == 0) {
  9. $money = $money - 12000;
  10. }
  11. if ($i % 2 !== 0) {
  12. $perNYears = 12000 + ($ComplatedYears * 50);
  13. $money = $money - $perNYears;
  14. $ComplatedYears+=2;
  15. }
  16. }
  17. if ($money >= 0) {
  18. printf("Yes! He will live a carefree life and will have %0.2f dollars left.", $money); }
  19. else{
  20. printf("He will need %0.2f dollars to survive." ,abs($money));
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement