main()

{

int x=5;

clrscr();

for(;x<= 0;x--)

{

printf("x=%d ", x--);

}

}

a. 5, 3, 1

b. 5, 2, 1,

c. 5, 3, 1, -1, 3

d. –3, -1, 1, 3, 5

Answers were Sorted based on User's Feedback



main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d &quo..

Answer / guest

prints nothing, as condition in loop is false.

Is This Answer Correct ?    33 Yes 3 No

main() { int x=5; clrscr(); for(;x<= 0;x--) { printf("x=%d &quo..

Answer / purushotam111

Just change the operator in for >= instead of <=
then our answer is 5 , 3 , 1

Is This Answer Correct ?    16 Yes 2 No

Post New Answer

More C Code Interview Questions

#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


main() { extern int i; i=20; printf("%d",i); }

1 Answers   Value Labs,


how to check whether a linked list is circular.

11 Answers   Microsoft,


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,


You are given any character string. Find the number of sets of vowels that come in the order of aeiou in the given string. For eg., let the given string be DIPLOMATIC. The answer returned must be "The number of sets is 2" and "The sets are "IO and AI". Vowels that form a singleton set must be neglected. Try to post the program executable in gcc or g++ or in java.

3 Answers  






What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql

0 Answers  


main() { extern int i; i=20; printf("%d",sizeof(i)); }

2 Answers  


main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }

2 Answers  


Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.

2 Answers  


void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }

4 Answers  


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


#define assert(cond) if(!(cond)) \ (fprintf(stderr, "assertion failed: %s, file %s, line %d \n",#cond,\ __FILE__,__LINE__), abort()) void main() { int i = 10; if(i==0) assert(i < 100); else printf("This statement becomes else for if in assert macro"); }

1 Answers  


Categories