aguz99

logic1-8.php

Aug 1st, 2018
37
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 8";
  3. include 'tplLogic1.php';
  4. include '../functions.php';
  5.  
  6. if (isset($_POST['submit'])) {
  7.     $r = $_POST['range'];
  8.     if ($r%2 == 0) {
  9.         $r+=1;
  10.     }
  11.    
  12.     echo "<table>";
  13.     for($y=1;$y<=$r;$y++) {
  14.         echo "<tr>";
  15.         for($x=1;$x<=$r;$x++) {
  16.             if ($x<=$y && $x<=$r-($y-1)) {
  17.                 td("*");
  18.             } elseif ($x>=$y && $x>=$r-($y-1)) {
  19.                 td("*");
  20.             } else {
  21.                 td();
  22.             }
  23.         }
  24.         echo "</tr>";
  25.     }
  26.     echo "</table>";
  27. }
Add Comment
Please, Sign In to add comment