write a program to display the numbers in the following
format
4 4
3 3 3 3
2 2 2 2 2 2
1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1
2 2 2 2 2
3 3 3
4

Answer Posted / bharath_471

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,n;
clrscr();
printf("enter the number");
scanf("%d",&n);
for(j=n,l=1;(j>0 && l<=n);j--,l++)
{
for(k=1;k<=2*l;k++)
printf("%d",j);
printf("
");
}
for(j=0,l=n;(j<=n && l>=0) ;j++,l--)
{
for(k=1;k<=2*l+1;k++)
printf("%d",j);
printf("
");
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain about block scope in c?

634


What is a macro?

628


Can we change the value of static variable in c?

542


What is exit() function?

540


What is spaghetti programming?

643






What is a floating point in c?

576


Why is a semicolon (;) put at the end of every program statement?

598


Differentiate between static and dynamic modeling.

592


How does sizeof know array size?

588


Write a program to check palindrome number in c programming?

572


Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?

2032


What is the translation phases used in c language?

603


What is strcmp in c?

579


What is a pointer in c?

661


what is the difference between 123 and 0123 in c?

697