Triangle pattern - Coder's point

Sunday, June 9, 2019

Triangle pattern

 
for($i=1;$i<=5;$i=$i+1){ for($j=1;$j<=5-$i;$j=$j+1){ print" "; } while($k!=2*$i-1){ print"* "; $k=$k+1; } $k=0; print"\n"; }

 OUTPUT:  
      *   
    * * *   
   * * * * *   
  * * * * * * *   
 * * * * * * * * *   

1 comment:

  1. Wow, This is very beautiful blog and its a lot of learn, thanks for sharing us.https://sisayed360.blogspot.com

    ReplyDelete