It's a simple binary chop:
Binary search algorithm - Wikipedia[
^] - one of the most basic ways of "narrowing in" on a unknown value in a range.
You start with the max and min possible values, and you guess halfway between them.
If the value is greater then halfway, the minimum becomes halfway.
If it is the same, you found it.
if it is less than halfway, the maximum becomes halfway
Repeat until found.
The twist here is that your homework requires it to be recursive (which is a pretty bad example of recursion, but hey! That's homework for you!)
And I'd add a test to your code to check the user input is in range...