Friday, May 31, 2024

php program to print diamond pattern

  

php program to print diamond pattern

php program to print diamond pattern


php program to print diamond pattern

Example:-

<?php
echo "<pre>";
for($i=1;$i<8;$i++)
{
    for($j=$i; $j<8;$j++)
    echo "&nbsp;&nbsp;";
for($j=2*$i-1;$j>0;$j--)
echo("&nbsp;*");
echo"<br>";
}
$n =8;
for($i=8;$i>0;$i--){
    for($j=$n-$i;$j>0;$j--)
    echo "&nbsp;&nbsp;";
 for($j=2*$i-1;$j>0;$j--)
 echo ("&nbsp;*");
echo "<br>";

}
echo"</pre>";
?>

 php program to print diamond pattern

Output :-
php program to print diamond pattern


Related Post :-

No comments:

Post a Comment