*
* *
* * *
* * * *
* * * * *
Program in php
<?php
for ($i=1; $i<=5 ; $i++) {
echo "*";
for($j=1;$j<$i;$j++){
echo "*";
}
echo "<br>";
}
?>
This output return using for loop in this output we return only * as pyramid.
It will work as start 1 to goes to 5 number as first loop like 1,2,3,4,5 and all this number are print in line because we have use <br> tag in last.
Now second loop is execute second time it will start as 1 and goes to last stop of $i value and increment every time like 1,12,123,1234 etc.
This php code we print only star so we use only for echo "*", it will print above pattern.
Vips The Dev.
Thanks.
* *
* * *
* * * *
* * * * *
Program in php
<?php
for ($i=1; $i<=5 ; $i++) {
echo "*";
for($j=1;$j<$i;$j++){
echo "*";
}
echo "<br>";
}
?>
This output return using for loop in this output we return only * as pyramid.
It will work as start 1 to goes to 5 number as first loop like 1,2,3,4,5 and all this number are print in line because we have use <br> tag in last.
Now second loop is execute second time it will start as 1 and goes to last stop of $i value and increment every time like 1,12,123,1234 etc.
This php code we print only star so we use only for echo "*", it will print above pattern.
Vips The Dev.
Thanks.
Comments
Post a Comment