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
Is c easier than java?
How many bytes are occupied by near, far and huge pointers (dos)?
Which node is more powerful and can handle local information processing or graphics processing?
Explain why c is faster than c++?
Are the outer parentheses in return statements really optional?
Explain what is output redirection?
to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?
What do you mean by command line argument?
Write a c program to demonstrate character and string constants?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
What are local static variables?
Write a program to print “hello world” without using semicolon?
Explain about the constants which help in debugging?
What is an endless loop?