C Program to print Inverted Equilateral Triangle in a pyramid star pattern
Program
#include<stdio.h>
void main()
{
int i, j, k, n;
printf("Enter number of rows of stars to print\n");
scanf("%d", &n);
for(i = n; i >= 1; i--)
{
for(j = n; j > i; j--)
{
printf(" ");
}
for(k = 1; k < (i * 2); k++)
{
printf("*");
}
printf("\n");
}
}
Output
Enter number of rows of stars to print
5
*********
*******
*****
***
*