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

How many levels of pointers can you have?

706


What is difference between %d and %i in c?

695


What is scanf_s in c?

634


What does emoji p mean?

606


What are the advantages of Macro over function?

1207






What is the meaning of typedef struct in c?

595


What is "Hungarian Notation"?

638


How pointer is different from array?

584


main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

914


Explain what is dynamic data structure?

648


#include int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

1268


How to delete a node from linked list w/o using collectons?

2090


Write a C program on Centralized OLTP, Decentralized OLTP using locking mechanism, Semaphore using locking mechanism, Shared memory, message queues, channel of communication, sockets and a simple program on Saving bank application program using OLTP in IPC?

2174


Can you return null in c?

598


What does volatile do?

568