C program to print reverse pyramid star pattern

• Write a program in C to print reverse pyramid star pattern or reverse equilateral triangle star pattern using for loop.
• How to print inverted equilateral triangle star pattern till n rows using loops.
For an reversed equilateral triangle pyramid star pattern of 5 rows. Program's output should be:

INVERTED PYRAMID STAR PATTERN

Required Knowledge

Algorithm to print inverted pyramid star pattern using loop
This C program is similar to pyramid star pattern, except we are printing the rows in reverse order.
• We first take the number of rows(N) in the pattern as input from user using scanf function.
• One iteration of outer for loop will print a row of inverted pyramid.
• For any row R, inner for loop first prints N-R spaces followed by (2*R - 1) star character.

C program to print inverted pyramid star pattern

```#include<stdio.h>

int main() {
int i, space, rows, star;
printf("Enter the number of rows\n");
scanf("%d",&rows);

for(i = rows;i >= 1; i--) {
/* Printing spaces */
for(space = 0; space <= rows-i; space++) {
printf(" ");
}
/* Printing stars */
star = 0;
while(star != (2*i - 1)) {
printf("*");
star++;
}
printf("\n");
}

return 0;
}
```
Output
```Enter the number of rows
5
*********
*******
*****
***
*
```

Related Topics
 C program pyramid star pattern C program hollow pyramid star pattern C program hollow diamond star pattern C program diamond star pattern C program binary rectangle pattern C program natural number triangle pattern C program heart shape star pattern C program hut star pattern C program hollow square star pattern List of all C pattern programs