ProAnswers.org

Write a C program to display the series of numbers as given below?

1
2 1
3 2 1
4 3 2 1
4 3 2 1
3 2 1
2 1
1

#include<stdio.h>

#include<conio.h>

void main()

{

int i,j,x;

printf(“\n enter value of x:”);

scanf(“%d”, &x);

clrscr();

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

{

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

{

Printf(“%3d”, i);

}

Printf(“\n”);

}

Printf(“\n”);

for(j=x;j<=1;j--)

{

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

{

Printf(“%3d”, i);

}

Printf(“\n”);

}

getch();

}

Output:

Enter value of x: 4

1

2 1

3 2 1

4 3 2 1

4 3 2 1

3 2 1

2 1

1