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

du u know test pattern for robosoft? Plz share

1 Answers   RoboSoft, TATA, Wipro,


what is a constant pointer in C

0 Answers  


write a program to generate 1st n fibonacci prime number

12 Answers  


how can u print a message without using any library function in c

1 Answers   NIIT,


how to find sum of digits in C?

21 Answers   CTS, Infosys,






Differentiate between the expression “++a” and “a++”?

0 Answers  


stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

0 Answers  


what is the difference between c and java?

1 Answers  


how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?

2 Answers   Patni, TCS,


Can the curly brackets { } be used to enclose a single line of code?

0 Answers  


What is a symbolic constant?

1 Answers  


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"

0 Answers  


Categories