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


Please Help Members By Posting Answers For Below Questions

How can I read/write structures from/to data files?

553


What is use of integral promotions in c?

667


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2252


What is the difference between ‘g’ and “g” in C?

2576


What is string constants?

662






What are the __date__ and __time__ preprocessor commands?

575


Is c pass by value or reference?

596


Tell us bitwise shift operators?

600


What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?

942


What is the sizeof () operator?

625


What is the use of a ‘’ character?

587


#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


Why calloc is better than malloc?

573


Write a program to reverse a given number in c language?

621


Write a program in c to replace any vowel in a string with z?

698