int pi_digits1=0;
int pi_digits2=0;
System.out.println("Would you like from starting to fixed no. or for a
range:\n1.Fixed no\n2.Range");
byte choice = input.nextByte();
if(choice ==1){
System.out.println("Enter the no. of digits after decimal within 1 million
of pi to see and play");
pi_digits2=input.nextInt();
}
else if(choice ==2){
System.out.println("Enter the smaller +ve no of range");
pi_digits1=input.nextInt();
System.out.println("Enter the larger +ve no of range");
pi_digits2=input.nextInt();
System.out.println("Check");
}
else{
System.out.println("Wrong choice.Program terminated");
}
При выборе 1 цикл работает нормально.
Но для выбора 2, после ввода входных данных для pi_digits2, он все еще спрашивает
для входов.
Чек также печатается, но программа заблокирована в цикле ввода и, следовательно,
дальнейший код не выполняется.
Программа выполнена в среде Bluej