emodev

Untitled

Dec 13th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. $steps= readline();
  4. $goal=10000;
  5. $allSteps=0;
  6. while(TRUE){
  7.  
  8.     if($steps=="Going Home"){
  9.         $steps= intval(readline());
  10.         $allSteps+=$steps;
  11.         if($allSteps<$goal){
  12.             $diff=$goal-$allSteps;
  13.             echo "$diff more steps to reach goal.";
  14.             break;
  15.         }else{
  16.             echo "Goal reached! Good job!";
  17.             break;
  18.         }
  19.     }
  20.     if($allSteps>=$goal){
  21.        echo  "Goal reached! Good job!";  
  22.        break;
  23.     }
  24.     $allSteps+= intval($steps);
  25.     $steps= intval(readline());
  26.    
  27. }
Add Comment
Please, Sign In to add comment