Bangeev

Untitled

Nov 26th, 2018
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2.  
  3. $sum = 0;
  4. while (true) {
  5.     $command = readline();
  6.     if ($command != "Going Home") {
  7.         $sum += intval($command);
  8.        if ($sum >= 10000) {
  9.        echo "Goal reached! Good job!";
  10.        break;
  11.        }
  12.     }if ($command == "Going Home") {
  13.     $command = readline();
  14.     $sum += intval($command);
  15.         printf("%.0f more steps to reach goal.", 10000 - $sum);
  16.     break;
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment