write a program for
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 1
2 2 2 2 2 2
3 3 3 3
4 4
Answer Posted / vidyullatha
#include<stdio.h>
main()
{
int i=0,k=0,l=0;
int cnt=1;
int space=7;
for (i=4;i>0;i--)
{
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
for(k=0;k<space;k++)
{
printf(" ");
}
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
cnt++;
space=space-2;
printf("\n");
}
for(i=0;i<9;i++)
{
printf("0 ");
}
printf("\n");
cnt=4;
space=1;
for(i=1;i<=4;i++)
{
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
for(k=0;k<space;k++)
{
printf(" ");
}
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
cnt--;
space=space+2;
printf("\n");
}
}
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Explain how do you view the path?
What header files do I need in order to define the standard library functions I use?
What are the properties of union in c?
What are the disadvantages of c language?
Without Computer networks, Computers will be half the use. Comment.
what is the syallabus of computer science students in group- 1?
What is difference between far and near pointers?
What is the sizeof () operator?
What are register variables? What are the advantage of using register variables?
How pointer is different from array?
What is the heap in c?
What is the use of getchar functions?
Is sizeof a keyword in c?
Describe wild pointers in c?
Is c still used?