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