Computer Science, asked by setu54, 1 year ago

int x= 2 ,y =4 ;
x - = x++ * ++y /x - --x;
System.out.println (x);​

Answers

Answered by apratimhaldar00
0

x-=x++ * ++y/x - --x

=> x = x - (x++ * ++y/x - --x)

=> x = 2 - (2 * 4/3 - 2)

=> x = 2 - (2 * 1 - 2)

=> x = 2 - (2 - 2)

=> x = 2 - 0

=> x = 2

Thus, The value of 'x' is 2 and the output is ---

2


setu54: ++y is 5
setu54: in third line
apratimhaldar00: Even then 5/3 will result in 1.
Answered by aalaparunp66okp
0

x = x - (x++ * ++y/x - --x)

x = 2 - (2 * 5/3 - 2)

x = 2 - (4/3)

x = 2 - 1                                        (Since it is int )

x = 1

Similar questions