ad

Friday, May 31, 2024

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