Thursday, January 28, 2016

PYRAMID IN PHP: Form a Pyramid Using Numbers in PHP

I created another PHP Code to dsiplay a pyramid out of numbers. This program uses two (2) looping statement. In my example, I did used the while and for loop to accomplished this.


If you want to change the limit of rows in the pyramid, just change the value 30 to whatever you desire.

PHP Code
<?php
$i=1;
while($i<=30)
{
for($i1=1;$i1<=$i;$i1++)
{
echo $i1;
}
echo "<br>";
$i++;
}
?>

Output









PYRAMID IN PHP: Form a Pyramid Using Numbers in PHP

PYRAMID IN PHP: Form a Pyramid Using Numbers in PHP Rating: 4.5 Diposkan Oleh: Emoblazz

0 comments:

Post a Comment