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 / jankipatel
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l,p;
clrscr();
// printf("enter the value\n");
// scanf("%d",&l);
for(i=4;i>=0;i--)
{
for(j=4;j>=i;j--)
{
// textcolor(0-i);
printf("%d ",i);
}
for(k=0;k<=i-1;k++)
{
printf(" ");
}
for(k=0;k<=i-1;k++)
{
printf(" ");
}
for(j=4;j>=i;j--)
{
// textcolor(0-i);
printf(" %d",i);
}
printf("\n");
}
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
printf(" ");
}
for(k=4;k>=i;k--)
{
printf("%d ",i);
}
for(k=4;k>=i;k--)
{
printf(" %d",i);
}
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
In C, What is the #line used for?
write a c program for swapping two strings using pointer
Explain how can you be sure that a program follows the ansi c standard?
Explain what is the difference between a string and an array?
Do you know the difference between malloc() and calloc() function?
Why does this code crash?
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
How can I do serial ("comm") port I/O?
Explain how can I prevent another program from modifying part of a file that I am modifying?
write a program for the normal snake games find in most of the mobiles.
Is linux written in c?
Difference between linking and loading?
Can we replace the struct function in tree syntax with a union?
Explain the advantages of using macro in c language?
Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon