write a program to display the numbers in the following
4 4
3 3
2 2
1 1
0
1 1
2 2
3 3
4 4



write a program to display the numbers in the following 4 4 3 ..

Answer / vidyullatha

#include<stdio.h>
main()
{
int i,j,k,l;
int space=7;
for(i=4;i>=0;i--)
{
for(j=4;j>i;j--)
{
printf(" ");
}
printf("%d ",i);
for(j=0;j<space;j++)
{
printf(" ");
}
if(space>0)
printf("%d ",i);
space = space-2;
printf("\n");
}
space = 1;
for(i=1;i<=4;i++)
{
for(j=4;j>i;j--)
{
printf(" ");
}
printf("%d ",i);
for(j=0;j<space;j++)
{
printf(" ");
}
printf("%d ",i);
space = space+2;
printf("\n");
}
}

Is This Answer Correct ?    6 Yes 0 No

Post New Answer

More C Interview Questions

print the pattern 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25 if n=5

3 Answers   Winit,


how to find out the union of two character arrays?

2 Answers  


main() {int a=200*200/100; printf("%d",a); }

14 Answers   TCS,


What are the advantage of c language?

0 Answers  


What is the importance of c in your views?

0 Answers  






Write a program to exchange two variaables without temp

9 Answers   Geometric Software,


What is property type c?

0 Answers  


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

0 Answers  


What functions are used in dynamic memory allocation in c?

0 Answers  


What is difference between structure and union in c programming?

0 Answers  


how to write a program which adds two numbers without using semicolon in c

2 Answers  


Compare and contrast compilers from interpreters.

0 Answers  


Categories