Advertisement
aguz99

logic1-7.php

Aug 1st, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. <?php
  2. $soal = "Soal 7";
  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)) {
  16.                 echo "<td>*</td>";
  17.             } elseif ($x>=$y && $x<=$r-($y-1)) {
  18.                 echo "<td>*</td>";
  19.             } else {
  20.                 echo "<td></td>";
  21.             }
  22.         }
  23.         echo "</tr>";
  24.     }
  25.     echo "</tables>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement