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. It is called a nested loop, a loop inside a loop.
If you want to change the limit of rows in the pyramid, just change the value 30 to whatever you desire.
Thank you for visiting and hope this helps you. Feel free to leave a comment below for any questions. I got some other articles related to php and mysql here in my blog. Watch out for more upcoming tutorials related to blogging and programming. Good day! ^_^
Try Pyramid in PHP here.
PHP Code Pyramid
<?php
$i=1;
while($i<=30)
{
for($i1=1;$i1<=$i;$i1++)
{
echo $i1;
}
echo "<br>";
$i++;
}
?>
No comments:
Post a Comment