Why the answer of this question is 150? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why the answer of this question is 150?

What is the output of this code? int x = 100; int y = 200; while (++x < --y) { }; System.out.print(x);

8th May 2020, 3:50 PM
Umidbek
Umidbek - avatar
2 Answers
0
So suppose x and y are at 149 and 151 now, so when x will reach 150 y will be 151 which is true and then y also becomes 150 and x value 150 is printed
8th May 2020, 3:58 PM
Abhay
Abhay - avatar
0
Ok, thanks understandable
8th May 2020, 4:12 PM
Umidbek
Umidbek - avatar