ad

Showing posts with label php pyramid pattern. Show all posts
Showing posts with label php pyramid pattern. Show all posts

Saturday, June 1, 2024

php program print inverted Pyramid star pattern in php


php program print inverted Pyramid star pattern in php

 php program print inverted Pyramid star pattern in php

Example :-

<?php
echo "<pre>";
$n =10;
for($a=10; $a>0;$a--)
{
  for($b=$n-$a; $b>0; $b--)
  echo "&nbsp;&nbsp;";
for($b=2*$a-1; $b>0; $b--)
echo "&nbsp;1";
//change only  echo ""; value
    //for example :- 1,d,4,h,9,...etc
echo"<br>";
}
echo"</pre>";
?>

 php program print inverted Pyramid star pattern in php

Output :-

php program print inverted Pyramid star pattern in php


Related Post :-

php program palindrome number

php for loop

css border property

php program to print number increasing reverse pyramid

 
php program to print number increasing reverse pyramid

Q. php program to print number increasing reverse pyramid

Example:-

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

}
?>
php program to print number increasing reverse pyramid

Output :-
php program to print number increasing reverse pyramid



Related Post ::-

php program to print heart star pattern

php program to print increasing triangle

php program to print alphabet pattern K

php program to print number increasing pyramid

php program to print number increasing pyramid


php program to print number increasing pyramid

Example :-
<?php
$k=1;
for($i=0;$i<4; $i++)
{
    for($j=0;$j<=$i;$j++)
    {
        echo $k. "";
        $k++;
    }
    echo "<br>";
}
    ?>
   
php program to print number increasing pyramid

Output:-
php program to print number increasing pyramid



Related Post :-

php program to print heart star pattern

php program to print heart star pattern

php program to print heart star pattern

Example:-

<?php
$size =6;
for($i=$size/2;$i<$size;$i+=2)
{
    for($j=1;$j<$size-$i;$j+=2)
    {
        echo "&nbsp;&nbsp;";
    }
    for($j=1;$j<$i+1;$j++)
    {
        echo '*';
    }
    for($j=1;$j<$size-$i+1;$j++)
    {
        echo "&nbsp;&nbsp;";
        }
        for($j=1;$j<$i+1;$j++)
        {
            echo "*";
        }
        echo '<br>';
}
for($i=$size;$i>0;$i--)
{
    for($j=0;$j<$size-$i; $j++)
    {
        echo "&nbsp;&nbsp;";
    }
    for($j=1;$j<$i*2;$j++)
    {
        echo '*';
    }
    echo "<br>";
}
?>

php program to print heart star pattern

Output :-

php program to print heart star pattern


Related Post :-

php form handing

php variable

html ordered list

php cookies

php program to print hourglass star pattern




php program to print hourglass star pattern



php program to print hourglass star pattern

Example :-


<?php
$size =5;
for($i=0; $i<$size;$i++)
{
    for($j=0;$j<$i;$j++)
    {
        echo "&nbsp;&nbsp;";
    }
    for($k=0;$k<($size-$i)*2-1;$k++)
    {
        echo"*";
    }
    echo "<br>";
}
for($i=2;$i<=$size;$i++){
    for($j=$size;$j>$i;$j--){
        echo "&nbsp;&nbsp;";
    }
    for($k=0;$k<$i*2-1;$k++)
    {
        echo '*';
        }
        echo'<br>';
}
?>


php program to print hourglass star pattern




Output :- 

php program to print hourglass star pattern



RElated Post :-

php program to print Hollow diamond star pattern


php program to print Hollow diamond star pattern

php program to print Hollow diamond star pattern

Example :-

<?php
$size =5;
for($i=1;$i<=$size;$i++)
{
    for($j=$size;$j>$i;$j--)
   
        {
            echo "&nbsp;&nbsp;";
        }
        for($k=0;$k<$i*2-1;$k++)
        {
            if($k===0||$k===2*$i-2)
            {
                echo "*";
            }
            else{
                echo "&nbsp;&nbsp;";
                        }
        }
        echo "<br>";
    }
    for($i=1;$i<=$size-1;$i++){
        for($j=0;$j<$i;$j++){
            echo "&nbsp;&nbsp;";
                }
                for($k=($size-$i)*2-1;$k>=1;$k--)  {
                    if($k===1||$k===($size-$i)*2-1){
                 echo "*";
                }
                        else {
                            echo "&nbsp;&nbsp;";
                        }
                    }
                    echo"<br>";
                }
                ?>

php program to print Hollow diamond star pattern

Output:-


php program to print Hollow diamond star pattern



Related Post :-

html id attribute

css menu design

php data and time function

Friday, May 31, 2024

php program to print hollow pyramid star pattern

 

php program to print hollow pyramid star pattern

php program to print hollow pyramid star pattern 

Example :-

<?php
$size=5;
for($i=0;$i<$size; $i++)
{
    for($j=0; $j<$size-$i-1;$j++)
    {
        echo "&nbsp;&nbsp;";
    }
    for($k=0;$k<2*$i+1;$k++)
    {
        if($i===0|| $i===$size-1)
        {
           echo '*';
           //only change value of echo '';
           //for example - 2,e,f,a,B,5..etc
        }
        else{
            if($k===0||$k===2*$i){
                echo '*';
            }
            else {
                echo '&nbsp;&nbsp;';
            }
        }
    }
    echo'<br>';
}
?>

php program to print hollow pyramid star pattern 

Output :-

php program to print hollow pyramid star pattern


Related  Post :-

how to create login form in php

php if else statements

bdi tag in html

php program to print hollow triangle star pattern


php program to print hollow triangle star pattern


 php program to print hollow triangle star pattern 

Example :-

<?php
$size =5;
for($i=1;$i<=$size;$i++)
{
    for($j=0;$j<$i;$j++)
    {
        if($i!=$size)
        {
            if($j==0||$j==$i-1)
            {
                echo '*';
            }
            else{
                echo "&nbsp;&nbsp;";
            }
        }
        else{
            echo'*';
        }
    }
    echo '<br>';
}
?>

php program to print hollow triangle star pattern 

Output:-

php program to print hellow triangle star pattern


Related Post :-

 php echo function

html button tag

php program to print alphabet pattern H

php program to print inverted right half pyramid

 

php program to print inverted right half pyramid

php program to print inverted right half pyramid

Example:-

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

php program to print inverted right half pyramid

Output:-

php program to print inverted right half pyramid


  1. Related Post:-
  2. css column gap property

  3. html iframe

  4. php program palindrome number

php program to print inverted left half pyramid pattern

php program to print inverted left half pyramid

php program to print inverted left half pyramid


php program to print inverted left half pyramid

Example :-

<?php
for($i=1;$i<=6;$i++)
{
    for($j=1; $j<=$i;$j++)
    {
        echo "&nbsp;&nbsp;";
        }
        for($l=5;$l>=$i;$l--)
        {
            echo '*';
        }
        echo '<br>';
}
?>

php program to print inverted left half pyramid

Output:-

php program to print inverted left half pyramid


Related post :-

javascript bitwise operators

forgot password form

how to create home page design

php program to print left half pyramid star pattern

 php program to  print left half pyramid 

php program to  print left half pyramid

php program to  print left half pyramid 

Example :-

<?php
for($i=1;$i<=5;$i++)
{
for($j=4;$j>=$i;$j--)
{
    echo "&nbsp;&nbsp;";
}
for($k=1;$k<=$i;$k++)
{
    echo '*';
    //change only value of the
    //echo' *';
    //for example :- 1,s,q,h,a,A....etc
}
echo '<br>';
}
?>

php program to  print left half pyramid 

Output:- 

php program to  print left half pyramid


Related  Post :-

html table tag

html id Attribute

css column gap property

php program to print triangle pattern

 

php program to print triangle pattern

php program to print triangle pattern


php program to print triangle pattern

Example :-

<?php
//Star Pyramid Size
$size = 7;
for($i=1;$i<=$size;$i++){
    for($j=1;$j<=$size-$i;$j++)
    {
        echo "&nbsp;&nbsp;";
    }
    for($k=1;$k<=$i;$k++){
             
        echo "*&nbsp;&nbsp;";
    }
echo "<br />";
}
?>

php program to print triangle pattern

Output:-

php program to print triangle pattern


Related Post :-

php program using sum of digits

registration form in php

article tag in html

how to create login form

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 :-

php for loop