Use loops to repeatedly guess a number and give feedback to the user, such as, "The number you guessed is too large" or "The number you guessed is too small", so that in repeated guesses the user can use that information to increase his/her chances of getting it right.
If the user does not type in a number, then criticize the user, and read again.
Also, limit the user to a maximum of ten guesses.
I am thinking of a number between 0 and 100.
What is your guess? 50
The number is too small
What is your guess? fish
"fish" is not a number!
What is your guess? 75
The number is too small
What is your guess? 87
The number is too large
What is your guess? 80
You have got it in 5 guesses!
I am thinking of a number between 0 and 100.
What is your guess? 10
The number is too small
What is your guess? 11
The number is too small
What is your guess? 12
The number is too small
What is your guess? 14
The number is too small
What is your guess? 34
The number is too small
What is your guess? 23
The number is too small
What is your guess? 45
The number is too small
What is your guess? 78
The number is too large
What is your guess? 31
The number is too small
What is your guess? 22
The number is too small
Better luck next time!