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
Explain about block scope in c?
What is a macro?
Can we change the value of static variable in c?
What is exit() function?
What is spaghetti programming?
What is a floating point in c?
Why is a semicolon (;) put at the end of every program statement?
Differentiate between static and dynamic modeling.
How does sizeof know array size?
Write a program to check palindrome number in c programming?
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?
What is the translation phases used in c language?
What is strcmp in c?
What is a pointer in c?
what is the difference between 123 and 0123 in c?