Program to print left pascal star pattern in php
left pascal star pattern in php
Example :-
<?php $size = 5; for ($i = 1; $i <= $size; $i++) { for ($j = 0; $j < $size - $i; $j++) { echo " "; } for ($k = 0; $k < $i; $k++) { echo "*"; } echo "<br>"; } for ($i = 1; $i <= $size - 1; $i++) { for ($j = 0; $j < $i; $j++) { echo " "; } for ($k = 0; $k < $size - $i; $k++) { echo "*"; } echo "<br>"; }?>left pascal star pattern in php
<?php
$size = 5;
for ($i = 1; $i <= $size; $i++) {
for ($j = 0; $j < $size - $i; $j++) {
echo " ";
}
for ($k = 0; $k < $i; $k++) {
echo "*";
}
echo "<br>";
}
for ($i = 1; $i <= $size - 1; $i++) {
for ($j = 0; $j < $i; $j++) {
echo " ";
}
for ($k = 0; $k < $size - $i; $k++) {
echo "*";
}
echo "<br>";
}
?>
Output:-
left pascal star pattern in php
Example :-
<?php
$size = 5;
for ($i = 1; $i <= $size; $i++) {
for ($j = 0; $j < $size - $i; $j++) {
echo " ";
}
for ($k = 0; $k < $i; $k++) {
echo "b";
}
echo "<br>";
}
for ($i = 1; $i <= $size - 1; $i++) {
for ($j = 0; $j < $i; $j++) {
echo " ";
}
for ($k = 0; $k < $size - $i; $k++) {
echo "b";
}
echo "<br>";
}
?>
Post a Comment