>Do not use a loop.
Smack your teacher, he's an idiot.
>ask three yes or no questions and a binary search to discover the answer.
Do you know how binary search works? You start in the middle and divide the range by half for each yes or no answer. For example, say the number is 3. You start at 4 and ask if 4 is greater than the number. You get a yes answer and cut out all values greater than or equal to 4. Your range is now {0,1,2,3}. Pick the middle element (2 to be consistent with the choice of 4) and ask again. 2 is less than 3, so you cut out all values less than or equal to 2. That gives you the range {3}. You've found the answer in two questions. At most, it should take three questions to find the answer.
The only hard part is figuring out the steps to take at each question, but that's a problem solving issue that you need to work out yourself if you want to learn anything from this assignment.