C Program to print Inverted Right angled Triangle in a pyramid star pattern Type 2
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 = 5; j > i; j--)
{
printf(" ");
}
for(k = 1; k <= i; k++)
{
printf("*");
}
printf("\n");
}
}
Output
Enter number of rows of stars to print
5
*****
****
***
**
*