Home > Back-end >  Is about the topic of Java statement inside the loop structure
Is about the topic of Java statement inside the loop structure

Time:01-08

Why don't you do it does not continue to circulation

CodePudding user response:

Because you only enter a data
You to enter
9 8 7 6 5 4 3 2 1 0
Try

CodePudding user response:

reference 1st floor qybao response:
because you just input a data
You to enter
9 8 7 6 5 4 3 2 1 0
Try




I want to achieve that piece should be how to write

CodePudding user response:

Just want to that sentence can be repeated

CodePudding user response:

Then you can change cycle control
 int a, Max=0, min=0; 
Do {
System. The out. Printf (" please enter an integer (0) : ");
a=input.nextInt();
If (a==0) break;//control exit the loop here
If (maxIf (min> A) min=a;
} the while (true);
System. The out. Printf (" the minimum is the maximum value is: % d: % d \ n ", Max, min);

CodePudding user response:

Int flag=0;
While (flag==0)
{
System. The out. Println (" please enter an integer ");
Scanner input=new Scanner(System.in);
If (input. NextInt ()==0) {
Flag=1;
}
)

CodePudding user response:

The
refer to the original poster recentlywe response:
why don't you do it does not continue to circulation


This is circular logic errors, while is true will continue to execute cycle, you a=9, while is false jump out of the loop,
  • Related