Home > Back-end >  Java inside a for loop statement and each everybody to help me have a look at the thank you!
Java inside a for loop statement and each everybody to help me have a look at the thank you!

Time:12-06

int x;
Int y;
For (x=1, y=1; X & lt;=100; X++) {
If (y & gt; 20)={
break;
}
If (y % 3==1) {
Y +=3;
continue;
}
Y=5;
}
System. The out. Println (" x="+ x +", y="+ y);

Why the results of 22 x=y=8 the y have no, why would be 22?
Trouble you

CodePudding user response:

Every cycle, y plus three direct, y>=20, just seven times meet the conditions, end of the program, so:
1 + 3 * 7=22 no problem ah,

  • Related