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
Why is struct padding needed?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
Is it valid to address one element beyond the end of an array?
What is the full form of getch?
Write a C program to count the number of email on text
What are type modifiers in c?
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
Is it possible to execute code even after the program exits the main() function?
What is the significance of scope resolution operator?
What is nested structure with example?
Explain about the constants which help in debugging?
Why c is called a mid level programming language?
I just typed in this program, and it is acting strangely. Can you see anything wrong with it?
Explain argument and its types.
What is a program?