posted 20 years ago
Hi,
In the given code printing is done after the while loop.
Here is how it works:
1st iteration initial value x = 4, y = 7
x < 5 evalutes to true , x is incremented x = 5
second operand is evaluated
y<8 is true , y is incremented, y = 8
2nd iteration initial value x = 5, y = 8
x<5 evalutes to false, x is incremented x = 6
because the first operand is false , the second operand is NOT evaluated(short circuit). y is not incremented
while loop terminates.
Hence the output is x = 6, y = 8
-Vani