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
What is meant by gets in c?
Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"
How to write a code for reverse of string without using string functions?
When do we get logical errors?
What is a good way to implement complex numbers in c?
What is a program?
What is a structure member in c?
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
Where static variables are stored in c?
What is an array in c?
application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above
Explain how can I make sure that my program is the only one accessing a file?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Explain indirection?
Write programs for String Reversal & Palindrome check