C Program to Generate Inverted Star Pyramid Pattern

C program to generate inverted star pyramid pattern using C programming language.

Star Pyramid Pattern Program in C


#include<stdio.h>

int main()
{
    int i, n, j;

    printf("Enter number of lines: ");
    scanf("%d", &n);

    for(i=n;i>=1;i--)
    {
        for(j=1;j<=n-i;j++)
        {
            printf(" ");
        }
        for(j=1;j<=2*i-1;j++)
        {
            printf("*");
        }
        printf("\n");
    }

    return 0;
}

Output of above program

Enter number of lines: 10

*******************
 *****************
  ***************
   *************
    ***********
     *********
      *******
       *****
        ***
         *