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 / 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=7;
for(i=1;i<=4;i++)
{
for(k=0;k<i;k++)
printf(" ");
for(l=1;l<=cnt;l++)
{
printf("%d ",i);
}
printf("\n");
cnt=cnt-2;
}
}
Is This Answer Correct ? | 19 Yes | 1 No |
Post New Answer View All Answers
What is the benefit of using an enum rather than a #define constant?
Explain can static variables be declared in a header file?
Explain what are linked list?
Explain about the constants which help in debugging?
hi, which software companys will take,if d candidate's % is jst 55%?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
application attempts to perform an operation?
What is the meaning of 2d in c?
What is the difference between malloc() and calloc() function in c language?
Explain the difference between null pointer and void pointer.
Can you please compare array with pointer?
Write a program to implement queue.
WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?
Should I learn data structures in c or python?