Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $goal = 10000;
- $totalSteps = 0;
- while ($totalSteps < $goal) {
- $command = readline();
- if ($command == "Going home") {
- $currentSteps = intval(readline());
- $totalSteps += $currentSteps;
- break;
- }
- $currentSteps = intval($command);
- $totalSteps += $currentSteps;
- }
- if ($totalSteps >= $goal) {
- echo "Goal reached! Good job!";
- } else {
- echo ($goal - $totalSteps) . " more steps to reach goal.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement