Pyramid Pattern in C

/* Pyramid Pattern in C */

#include <stdio.h>

#include <conio.h>

int main()

{

int i,j,k;

int p_height=5;

for(i=1; i<=p_height; i++)

{

for(k=p_height-1; k>=i; k--) 

{

printf(" "); 

for(j=1; j<=i; j++) 

}

printf("*"); // space after '*' 

printf("\n");

}

return 0;


/*-- Another Logic -------*/


#include <stdio.h>

int main()

{

int n=5;//size

int i,j;

for(i=1; i<=n; i++)

{

for(j=n; j>=1; j--) 

{

if (i>=j)

printf("*"); // space after '*'

else

printf(" ");

}

 printf("\n");

}

return 0;

 Output:- 












Comments

Popular posts from this blog

Basic Computer 🖥️💻 Organisation

Introduction of computer 🖥️🖥️🖱️