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 / venkatesh

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {

int i,j,k,n1,n2;
printf("
enter n1 value:");
scanf("%d",&n1);
k=4;
for(i=1;i<=n1;)
{

for(j=i;j<=2*i;j++)
{
printf("%d ",k);

}

printf("
");
i=i+2;
k=k-1;
}
k=0;
n2=n1+1;
for(i=9;i>=1;)
{
for(j=1;j<=i;j++)
{
printf("%d ",k);
}
printf("
");
k=k+1;
i=i-2;
}

return 0;
}

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I access an I o board directly?

854


Combinations of fibanocci prime series

1376


Who invented b language?

1162


hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .

2177


Can a file other than a .h file be included with #include?

892


How can I recover the file name given an open stream?

772


What is the function of multilevel pointer in c?

859


Difference between MAC vs. IP Addressing

861


How to draw the flowchart for structure programs?

8988


How can I write a function analogous to scanf?

908


What is an endless loop?

1068


What is the scope of an external variable in c?

796


can we change the default calling convention in c if yes than how.........?

2303


Explain what is the difference between null and nul?

911


What is wrong with this statement? Myname = 'robin';

1078