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


Please Help Members By Posting Answers For Below Questions

Explain what is output redirection?

651


which is conditional construct a) if statement b) switch statement c) while/for d) goto

726


a program that can input number of records and can view it again the record

1471


What is c value paradox explain?

562


What are the header files used in c language?

571






What is the significance of an algorithm to C programming?

580


Explain what are global variables and explain how do you declare them?

624


What is volatile keyword in c?

569


What are keywords in c with examples?

590


What is a ternary operator in c?

636


What are the similarities between c and c++?

585


How many keywords (reserve words) are in c?

603


What is variable declaration and definition in c?

487


What is difference between union and structure in c?

564


Can you explain what keyboard debouncing is, and where and why we us it? please give some examples

1640