Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $cash = readline();
- $yearsToLive = readline();
- $years = 18;
- for ($i = 1800; $i <= $yearsToLive; $i++) {
- if ($i % 2 === 0) {
- $cash -= 12000;
- } else {
- $cash -= 12000 + $years * 50;
- }
- $years++;
- }
- $diff = abs($cash);
- if ($cash >= 0) {
- printf("Yes! He will live a carefree life and will have %.2f dollars left.", $diff);
- } else {
- printf("He will need %.2f dollars to survive.", $diff);
- }
- //DvDty
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement