C Program to print Hollow Inverted Right angled Triangle in a pyramid star pattern Type 1

Program

#include<stdio.h>
void main()
{
    int i, j, rows;
    printf("Enter number of rows: ");
    scanf("%d", &rows);
    for(i = 1; i <= rows; i++)
    {
        for(j = i; j < =rows; j++)
        {
            if(i == 1 || j == i || j == rows)
            {
                printf("*");
            }
            else
            {
                printf(" ");
            }
        }
        printf("\n");
    }
}

Output

Enter number of rows: 5
*****
*  *
* *
**
*