Pattern Printing:Full pyramid in C

 

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

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

            printf("*");
        }
        printf("\n");
    }

    return 0;
}

Output:

Enter value of n rows: 5
     *
    ***
   *****
  *******
 *********

Process returned 0 (0x0)   execution time : 2.581 s
Press any key to continue.

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published.