fixed get_inrange() function

simplified the code using scanf instead of getchar