aguz99

logic1-3.php

Aug 1st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. <?php
  2. $soal = "Soal 3";
  3. include 'tplLogic1.php';
  4. if (isset($_POST['submit'])) {
  5.     # mengambil range
  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)) {
  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