1. Write a program for this pattern ?
* * * * *
* * * *
* * *
* *
*
Example
Code
for ($i=5; $i>0; $i--) {
for ($j=0; $j < $i; $j++) {
echo "*";
}
echo "<br>";
}
This output is print using for loop and it will first starting form 5 and decrements to 1
inside use the second loop is also the for .loop it will stating form 0 and goes to length above loop last stop increment to end of the length.
it will coun.5,4,3,2.....
Thanks
* * * * *
* * * *
* * *
* *
*
Example
Code
for ($i=5; $i>0; $i--) {
for ($j=0; $j < $i; $j++) {
echo "*";
}
echo "<br>";
}
This output is print using for loop and it will first starting form 5 and decrements to 1
inside use the second loop is also the for .loop it will stating form 0 and goes to length above loop last stop increment to end of the length.
it will coun.5,4,3,2.....
Thanks
Comments
Post a Comment