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
Does c have class?
What is atoi and atof in c?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?
What is the use of pragma in embedded c?
Do you have any idea how to compare array with pointer in c?
Explain what is a static function?
What is main return c?
Explain how can a program be made to print the name of a source file where an error occurs?
What is the explanation for prototype function in c?
What is wrong with this program statement? void = 10;
What is a structural principle?
What is the difference between far and near in c?
What does the error 'Null Pointer Assignment' mean and what causes this error?
What is the use of a conditional inclusion statement in C?
Write the test cases for checking a variable having value in range -10.0 to +10.0?