C Program to Print Full Number Pyramid

In this program, you'll learn to print full number pyramid.



Source Code

#include<stdio.h>

int main()
{
    int i, j, s, k;

    for(i=0; i<4; i++)
    {
        for(s=0; s<3-i; s++)
        {
            printf("  ");
        }
        for(j=0;j<=i; j++)
        {
            printf("%d ", j+1);
        }
        for(k=j-1;k>0; k--)
        {
            printf("%d ", k);
        }
        printf("\n");
    }
    return 0;
}
Output
      1
    1 2 1
  1 2 3 2 1
1 2 3 4 3 2 1