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 / mahesh
#include<stdio.h>
int main()
{
int a=2,n=4,i,j,k;
for (i=4;i>=0;i--)
{
for(j=0;j<a;j++)
{
printf("%d",n);
}
printf("
");
a=a+2;
n--;
}
n=1;
a=a-4;
for(i=0;i<=4;i++)
{
for(j=0;j<a;j++)
{
printf("%d",n);
}
printf("
");
a=a-2;
n++;
}
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Explain how can a program be made to print the name of a source file where an error occurs?
Is it cc or c in a letter?
Why pointers are used?
Is a house a mass structure?
Explain what are the __date__ and __time__ preprocessor commands?
What functions are used in dynamic memory allocation in c?
What is the best way of making my program efficient?
What is null pointer constant?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
What is bin sh c?
What is the difference between near, far and huge pointers?
Explain why can’t constant values be used to define an array’s initial size?
Explain what is the heap?
Explain null pointer.
Can a variable be both static and volatile in c?