Advertisement
ini_PlayeR

While_2

Apr 14th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. <form method="get" action="">
  2.     Masukkan jumlah anak ayam <input type="text" name ="jum"><br>
  3.     <input type="submit" name="submit" value="submit">
  4.     <input type="reset" name="reset" value="reset">
  5. </form>
  6.  
  7. <?php
  8.     $i=$_GET[jum];
  9.     echo"Anak ayam turun ".$i."<br>";
  10.     while($i>=2)
  11.     {
  12.         $x=$i-1;
  13.         echo"Anak ayam turun ".$i." mati satu tinggal ".$x."<br>";
  14.         $i--;
  15.     }
  16.     echo"Anak ayam turun ".$i." mati satu tinggal induk ayam";
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement