Cetak Piramida dengan PHP

Berikut ini scrip untuk mencetak piramida

<?php

for($a=1; $a<=6; $a++)

{ echo”<center>;

for($b=1; $b<=$a; $b++)

{ echo”*”;}

echo “<br>”;

}

?>

  1. Tinggalkan sebuah Komentar

Tinggalkan Balasan

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Ubah )

Twitter picture

You are commenting using your Twitter account. Log Out / Ubah )

Facebook photo

You are commenting using your Facebook account. Log Out / Ubah )

Connecting to %s

Ikuti

Get every new post delivered to your Inbox.