plz tell me the solution..........

in c language program guess any one number from 1 to 50 and
tell that number within 8 asking question in yes or
no...............

Answers were Sorted based on User's Feedback



plz tell me the solution.......... in c language program guess any one number from 1 to 50 and ..

Answer / danish

he ask for 8 question
so it can be any 8 question ,
now use divide -conquer apprach to solve this problem as
Is it number <= 25
then, again split the range and within 8 question you can solve question......

GOOD BYE

Is This Answer Correct ?    5 Yes 0 No

plz tell me the solution.......... in c language program guess any one number from 1 to 50 and ..

Answer / abhisai

yes we can know it easily

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More C Code Interview Questions

Give a oneline C expression to test whether a number is a power of 2?

25 Answers   EA Electronic Arts, Google, Motorola,


What are the following notations of defining functions known as? i. int abc(int a,float b) { /* some code */ } ii. int abc(a,b) int a; float b; { /* some code*/ }

1 Answers  


Write a c program to search an element in an array using recursion

1 Answers   Wipro,


main() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }

1 Answers  


Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,






#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }

1 Answers  


void main() { int *i = 0x400; // i points to the address 400 *i = 0; // set the value of memory location pointed by i; }

2 Answers  


how can i cast a char type array to an int type array

2 Answers  


main() { char *str1="abcd"; char str2[]="abcd"; printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd")); }

1 Answers  


How will u find whether a linked list has a loop or not?

8 Answers   Microsoft,


main() { int i = 258; int *iPtr = &i; printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) ); }

1 Answers  


main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


Categories