mercredi 18 novembre 2015

Java: Is there a way to know 'how' close you are to a number?

I'm doing a random number guessing game (generate a random number between 1 and 25, user has 5 tries to guess the number). I'm required to say things like "You're really close to the number" or "You're really far off the number" according to how close the number the user entered is to the randomly generated number.

Is there any way to do this?




Aucun commentaire:

Enregistrer un commentaire