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 / 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 |
What is the memory allocated by the following definition ? int (*x)[10];
Write a C program to perform some of the operation which can be performed using Single linked list
write a program for even numbers?
What is the size of enum in c?
How can I use a preprocessorif expression to ?
What is the difference between malloc calloc and realloc in c?
void main() { int *ptr; ptr = (int *) 0x400 ; printf("ptr=%d",ptr); } output?
Tell me what are bitwise shift operators?
what do u mean by Direct access files? then can u explain about Direct Access Files?
Explain how are portions of a program disabled in demo versions?
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Where is volatile variable stored?