Friday, January 29, 2016

PYRAMID IN PHP: Form an Upside Down 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. On my previous article, the output of the pyramid is different. This one, its an upside down triangle.


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=15;
while($i>=1)
{
for($i1=1;$i1<=$i;$i1++)
{
echo $i1;
}
echo "<br>";
$i--;
}
?>

Output








PYRAMID IN PHP: Form an Upside Down Pyramid Using Numbers in PHP

PYRAMID IN PHP: Form an Upside Down Pyramid Using Numbers in PHP Rating: 4.5 Diposkan Oleh: Emoblazz

0 comments:

Post a Comment