/* Pattern problems in PHP */
/* 1 */
";
}
?>
/*
Output
*
*
*
*
*
*/
/* Print Triangle of Stars in PHP */
";
}
?>
/*
Output
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
*/
/*Print Star Pattern in PHP */
";
}
?>
/*
Output
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
*/
/* Print Star Pattern in PHP */
=1;$j--)
{
echo "* ";
}
echo "
";
}
?>
/*
Output
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
*/
/* Print Triangle of Stars in PHP */
=1; $a--)
{
if($a%2 != 0)
{
for($b=5; $b>=$a; $b--)
{
echo "* ";
}
echo "
";
}
}
for($a=2; $a<=5; $a++)
{
if($a%2 != 0)
{
for($b=5; $b>=$a; $b--)
{
echo "* ";
}
echo "
";
}
}
?>
/*
Output
*
* * *
* * * * *
* * *
*
*/
/*
Print Star Pattern in PHP*/
3 ? 6 - $row : $row); $col++)
{
echo '* ';
}
echo "";
}
?>
/*
Output
*
* *
* * *
* *
*
*/
/* Print Triangle of Stars in PHP*/
=$i;$k--)
{
echo " ";
}
for($j=1;$j<=$i;$j++)
{
echo "* ";
}
echo "
";
}
for($i=5;$i>=1;$i--)
{
for($k=6;$k>=$i;$k--)
{
echo " ";
}
for($j=1;$j<=$i;$j++)
{
echo "* ";
}
echo "
";
}
?>
/*
Output
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
*/
* * * * * * * * * * * * * * *
* * * * * * * * * * * * *
* * * * * * * * * * *
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
=1;--$i)
{
for($space=0;$space<$rows-$i;++$space)
echo " ";
for($j=$i;$j<=2*$i-1;++$j)
echo "* ";
for($j=0;$j<$i-1;++$j)
echo "* ";
echo "
";
}
}
?>
Program to print below format.
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Hide Answer
=1;--$i)
{
for($j=1;$j<=$i;++$j)
{
echo $j;
}
echo "
";
}
}
?>
Program to print below format
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
Hide Answer
";
}
}
?>
/* Write a program to print below format
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
*/
";
}
}
/*
Write a program to print the below format :
1 5 9
2 6 10
3 7 11
4 8 12
*/
";
}
?>
Write a program for this Pattern:
*****
* *
* *
* *
*****
Hide Answer
";
}
?>
How to write a Floyd's Triangle?
1
23
456
78910
1112131415
Hide Answer
';
}
?>
Write a program to make a chess:
Hide Answer
"; } else { echo " | "; } } echo ""; } ?> |