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


Please Help Members By Posting Answers For Below Questions

What is the benefit of using an enum rather than a #define constant?

643


Explain can static variables be declared in a header file?

660


Explain what are linked list?

607


Explain about the constants which help in debugging?

836


hi, which software companys will take,if d candidate's % is jst 55%?

1646






the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

711


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)

1851


application attempts to perform an operation?

1482


What is the meaning of 2d in c?

596


What is the difference between malloc() and calloc() function in c language?

587


Explain the difference between null pointer and void pointer.

654


Can you please compare array with pointer?

601


Write a program to implement queue.

649


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1846


Should I learn data structures in c or python?

567