#include <stdio.h>
int main() {
int rows;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for (int i = rows; i >= 1; i--) {
for (int j = 1; j <= rows - i; j++) {
printf(" ");
}
for (int j = 1; j <= 2 * i - 1; j++) {
printf("*");
}
printf("\n");
}
return 0;
}
Enter the number of rows: 7
*************
***********
*********
*******
*****
***
*rows to store the number of rows in the inverted pyramid.printf and scanf.for loop to print the inverted pyramid. The loop runs from rows to 1, and each iteration of the loop prints one row of the pyramid.for loop to print the spaces before the stars. The number of spaces to be printed in each row is equal to rows - i.for loop to print the stars in the row. The number of stars to be printed in each row is equal to 2 * i - 1.printf to move to the next row of the pyramid.