PHP Program to print Alphabet Pattern K
PHP Program to print Alphabet Pattern K
Q. What is Alphabet Pattern?
1] Alphabet Patterns is a series of letters arranged in a specific order or shape.
2] There are many type of paper patterns (such as triangles, squares , circles formed ,B,C,d arranging letters..etc).
3] They can also be used creatively in typography.
PHP Program to print alphabet Pattern K
Program
<?phpecho "<pre>";$j=7;$i =0; for($row =0; $row<=10; $row++) { for($col=0;$col<=10;$col++) { if($col==1 or (($row == $col +3) AND $col !=0)) { echo "k"; } else if($row == $i AND $col == $j) { echo "k"; $i = $i+1; $j = $j-1; } else{ echo " "; } } echo "<BR>";
} echo "</pre>"; ?>Output
<?php
echo "<pre>";
$j=7;
$i =0;
for($row =0; $row<=10; $row++)
{
for($col=0;$col<=10;$col++)
{
if($col==1 or (($row == $col +3)
AND $col !=0))
{
echo "k";
}
else if($row == $i AND $col == $j)
{
echo "k";
$i = $i+1;
$j = $j-1;
}
else{
echo " ";
}
}
echo "<BR>";
}
echo "</pre>";
?>
Post a Comment