Program in C to print the star pyramid structure

Write a program in C to print the following star pyramid structure: 

*********
*******
*****
***


Solution:
#include<stdio.h>
intmain()
{
intn=9,r,c;
for(r=5; r>=1; r--,n=n-2)
{
for(c=1; c<=n; c++)
printf("*");
printf("\n");
}
return 0;
}



Post a Comment