fork download
  1. <?php
  2. //Guntur Ahmad Lion Putranto 10122554 3KA31
  3. $baris = 5; // Jumlah baris segitiga
  4.  
  5. $i = 1;
  6. do {
  7. for ($j = 1; $j <= $baris - $i + 1; $j++) {
  8. echo "<p>&nbsp</p>";
  9. }
  10. for ($k = 1; $k <= $i; $k++) {
  11. echo "$k";
  12. }
  13. echo "\n";
  14. $i++;
  15. } while ($i <= $baris);
  16. ?>
Success #stdin #stdout 0.03s 25756KB
stdin
Standard input is empty
stdout
<p>&nbsp</p><p>&nbsp</p><p>&nbsp</p><p>&nbsp</p><p>&nbsp</p>1
<p>&nbsp</p><p>&nbsp</p><p>&nbsp</p><p>&nbsp</p>12
<p>&nbsp</p><p>&nbsp</p><p>&nbsp</p>123
<p>&nbsp</p><p>&nbsp</p>1234
<p>&nbsp</p>12345