PHP Pyramid Part XII

PHP Pyramid Part 12
PHP Pyramid Part 12

<?php
 $limit = 5;
 for($i=0;$i<=$limit;$i++) 
 { 
   for($j=$limit;$j>=$i;$j--)
   {
     echo "&nbsp;&nbsp;";
   }
   echo "1";
   for($x=1;$x<=$i;$x++)
   {
     echo "0";
   }
   echo "1";
   echo "<br/>";
 }
?>
Output:
     11
    101
   1001
  10001
 100001
1000001

 

You may also like...