Saturday, March 24, 2018

Number Pyramid Program In PHP

This Program Is About How To Create Pyramid Of Number In PHP.


1 next program


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

2 next program



<?php
echo"<br>";

$i;
$j;
for($i=1;$i<=5;$i++)
{
for($j=1;$j<=$i;$j++)
{
echo"$j";
}
echo"<br>";
}
?>



3 next program


<?php

echo"<br>";
$i;
$j;
for($i=1;$i<=5;$i++)
{
for($j=$i;$j>=1;$j--)
{
echo"$i";
}
echo"<br>";
}
?>

No comments:

Post a Comment

Generate Even Numbers in a Range In PHP.

$start = 1; $end = 20; for ($i = $start; $i <= $end; $i++) {     if ($i % 2 == 0) {         echo $i . " is even.<br>";   ...