0

The user must enter a number between 1 and 5. My problem is that when the user enters the value 0, the program doesn't close.

I don't understand where comes the problem?

int number = -1;

while(number < 1 || number > 5){
  System.out.print("Enter your number please : ");
  number= input.nextInt();
}
julie
  • 65
  • 6

0 Answers0