//making pyramid u just enter the number of rows and get a pyramid like u entered the row number as output
#include<stdio.h>
int main()
{
    int rows, i, number_of_space, k = 0;
    printf("Enter the number of rows(<=40): ");
    scanf("%d", &rows);

    for(i = 1; i <= rows; i++)

    {
        for(number_of_space = 1; number_of_space <= rows - i; number_of_space++)
        {
            printf(" "); //print needed space for pyramid
        }

        while( k != 2*i-1)

        {
            printf("*"); //print needed star(*) for pyramid
            k++;
        }
        k = 0;
        printf("\n"); //print new line
    }
    return 0;
}

Sample Input: 5

                         10

Sample Output:




Related Post (Make a pattern Like..)
After this Post (Fibonacci Number)