Tagged: PHP Pyramid

PHP Pyramid Part 6

Pyramid in PHP Part VI

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

PHP Pyramid Part 5

Pyramid in PHP Part V

<?php $limit = 5; for($i=0;$i<=$limit;$i++) { for($x=0;$x<$i;$x++) { if($x==0) { echo “1”; continue; } echo “0”; } echo “<br/>”; } ?> Output: 1 10 100 1000 10000  

PHP Pyramid Part 4

Pyramid in PHP Part IV

<?php $limit = 5; for($i=0;$i<=$limit;$i++) { for($k=$i;$k>0;$k–) { echo “*”; } echo “<br/>”; } ?> Output: * ** *** **** *****