C Program to Generate Half Pyramid Star Pattern

C program to generate half pyramid star (*) pattern using C programming language.

Star Half Pyramid Pattern Program in C


#include<stdio.h>

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

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

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

    return 0;
}

Output of above program

Enter number of lines: 10

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