Numeric Pyramid Program in C: In c we can build various pyramids with numbers, alphabets or stars etc.

Page Contents

## Program – 1

Implement following numeric pyramid program in c
1
12
123
1234
12345

### Number pattern programs in c

#include <stdio.h>

int main()
{
int i ,j;

printf("Number pyramid:\n");

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

{

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

{

printf("%d",j);

}

printf("\n");

}
return 0;
}

OutPut :

## Program – 2

Implement following numeric pyramid program in c
12345
2345
345
45
5

### Numberic pattern programs in c

#include <stdio.h>

int main()
{
int i ,j;

printf("Number pyramid:\n");

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

{

for(j=i;j<=5;j++)

{

printf("%d",j);

}

printf("\n");

}
return 0;
}

OutPut :

## Program – 3

Implement the following numeric pyramid.
55555
45555
34555
23455
12345

### Program for number pattern

#include <stdio.h>

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

printf("Number pyramid:\n");

for(i=5;i>=1;i--)

{

k=i;

for(j=1;j<=5;j++)

{

if(k<=5){

printf("%d",k);

}

else{

printf("5");

}

k++;

}

printf("\n");

}
return 0;
}

Output :

## Program – 4

Implement numeric diamond pyramid
1
121
12321
1234321
12321
121
1

### C program for number pattern

#include <stdio.h>

int main()
{
int num,r,c,sp;

printf("\nEnter number of rows :");

scanf("%d",&num);

for(r=1;r<=num;r++)

{

for(sp=num-r;sp>=1;sp--)

printf(" ");

for(c=1;c<=r;c++)

printf(" %d",c);

for(c=r-1;c>=1;c--)

printf("  %d",c);

printf("\n");

}

for(r=1;r<=num;r++)

{

for(sp=r;sp>=1;sp--)

printf(" ");

for(c=1;c<=(num-r);c++)

printf(" %d",c);

for(c=num-r-1;c>=1;c--)

printf(" %d",c);

printf("\n");

}
return 0;
}

Output :

## Program – 5

Implement following a numeric pyramid
1
23
4
56
7
89
10

### C program for numeric pattern

#include <stdio.h>

int main()
{
int r ,c,x ,y;

static int i=1;

for(r=1;r<=7;r++)

{

if(r%2==0)

{

for(x=2;x>=1;x--,i++)

printf("%d",i);

}

else

{

for(y=1;y>=1;y--,i++)

printf("%d",i);

}

printf("\n");

}

return 0;
}

Output :

## Program – 6

Implement the following numeric pyramid.
1
1 2
1 2 3

### Numeric pyramid program in C

#include <stdio.h>

int main()
{
int num,r,c,sp;

printf("Number pyramid:\n");

printf("Enter number till you want pyramid:\n");

scanf("%d",&num);

for(r=1;num>=r;r++)

{

for(sp=num-r;sp>=1;sp--)

printf(" ");

for(c=1;c<=r;c++)

printf("%d",c);

printf("\n");

}

return 0;
}

OutPut :