Friday 28 July 2017

Program to print below format..

Program to print below format.
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1





<?php
   $rows=5;  // number of row
   for($i=$rows;$i>=1;--$i)
     {
         for($j=1;$j<=$i;++$j)
         {
            echo $j;
         }
     echo "<br />";
     }
 ?>
 

No comments:

Post a Comment