0001 0010 0100 1000 Pyramid Using PHP
<?php
$k=5;
for($a=1;$a<=5;$a++)
{
for($b=1;$b<=5;$b++)
{
if($a==$b)
{
echo "1";
}
else
{
echo "0";
}
}
echo "</br>";
} // design by dhara ripal pandya
?>
OUTPUT:
10000
01000
00100
00010
00001
_____________________________________
<?php
$k=6;
for($a=0;$a<5;$a++)
{
$k--;
for($b=1;$b<5;$b++)
{
if($k==$b)
{
echo "1";
}
else
{
echo "0";
}
}
echo "</br>";
}
//Developed By: My Wife (Dhara Ripal Pandya)
?>
OUTPUT:
0000
0001
0010
0100
1000