0
Need solution
int x=0; int y=2; do{x+=y;} while(x<4); Syste.out.print(++x); How the output is 5? It should 3...
2 ответов
+ 3
Initially, the value of x is 0. The do while loop will execute until the condition in while is met. Here the loop will execute twice, i.e., the value of x will become 4. Then, since x = 4 the condition in while is not satisfied as x is not less than 4 and the loop will end. Next you're outputting the value of x after incrementing it by 1. Therefore, the value of x = 4 + 1 = 5.