Eg. 1.
1
2 3
4 5 6
7 8 9 10
$space=20; for($i=1,$k=1;$i<5 ;$i++) //loop for print rows { for($l=1;$l<=$space;$l++)//loop for print space echo ' '; $space -=2; for($j=1;$j<=$i;$j++,$k++) /*loop for print columns*/ echo $k.' '; echo '<br>'; }Output:
1
2 3
4 5 6
7 8 9 10
No comments:
Post a Comment