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 are the string functions? List some string functions available in c.
x=y=z=1 z=++x||++y&&++z Printf("%%%d";xyz) what is the values of x,y and z?????
what is the use of #pragma pack, wer it is used?
What is wrong in this statement?
what is the structure pointer?
how can write all 1to 100 prime numbers using for loop,if and break ?
How can I implement sets or arrays of bits?
Write a routine that prints out a 2-D array in spiral order!
How do we select the big element or any other operation from array which is read dynamically. user need to give the elements only no need to mention the size.
What is spaghetti programming?
what is the meaning of java that is (J A V A) full form of JAVA
71 Answers AKS University, Bhel, BNL, BPO, HCL, Peacecon,
how many header file is in C language ?
44 Answers College School Exams Tests, CTS, IBM, IMS, Infosys, ME, Sign Solutions, Wipro, XVT,