- Write a C program to print reverse pyramid star pattern.
- 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:

Required Knowledge
- For Loop
- printf and scanf function in C
Algorithm to print inverted pyramid star pattern using loop
Pyramid in c: 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(R) in the pattern as input from user using scanf function.
- Outer for loop(from i = 0 to R-1) will print a row of inverted pyramid in one iteration.
- For jth row, inner for loops first prints i spaces followed by (2*(R-i) – 1) star character.
Here is the matrix representation of the inverted pyramid star pattern. The row numbers are represented by i whereas column numbers are represented by j.

C program to print inverted pyramid star pattern

#include<stdio.h>
int main() {
int i, j, rows;
printf("Enter the number of rows\n");
scanf("%d", &rows);
for (i = 0; i < rows; i++) {
/* Printing spaces */
for (j = 0; j < i; j++) {
printf(" ");
}
/* Printing stars */
for (j = 0;j < 2*(rows-i)-1; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
Output
Enter the number of rows
5
*********
*******
*****
***
*