* * * * * * * * * * * * * * * 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.
Posts
Showing posts from August, 2019
- Get link
- X
- Other Apps
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