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



write a program for 4 4 3 3 3 3 2 2 2 2 ..

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

Post New Answer

More C Interview Questions

How a string is stored in c?

0 Answers  


Why are algorithms important in c program?

0 Answers  


what different between c and c++

1 Answers  


the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?

0 Answers  


a=5 a=a++/++a

14 Answers   Bhel,


Is c is a low level language?

0 Answers  


dibakar & vekatesh..uttejana here..abt ur reply for in place reversal of linked list..wats p stands for there?

1 Answers  


What is C language ?

0 Answers   Jekson,


which do you prefer C or Pascal?

1 Answers  


Is main is user defined function?

0 Answers  


what is the self-referential structure?

1 Answers  


What are called c variables?

0 Answers  


Categories