aguz99

logic1-4.php

Aug 1st, 2018
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.41 KB | None | 0 0
  1. <?php
  2. $soal = "Soal 4";
  3. include 'tplLogic1.php';
  4.  
  5. if (isset($_POST['submit'])) {
  6.     $r = $_POST['range'];
  7.     if ($r%2 == 0) {
  8.         $r+=1;
  9.     }
  10.  
  11.     echo "<table>";
  12.     for($y=1;$y<=$r;$y++) {
  13.         echo "<tr>";
  14.         for($x=1;$x<=$r;$x++) {
  15.             if ($x==$y || $x==$r-($y-1) || $x==round($r/2) || $y==round($r/2)) {
  16.                 echo "<td>*</td>";
  17.             } else {
  18.                 echo "<td></td>";
  19.             }
  20.         }
  21.         echo "</tr>";
  22.     }
  23.     echo "</table>";
  24. }
Add Comment
Please, Sign In to add comment