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