+ 1

Why this output is 16

Int x =8; Int y=7; x++; x+=y--;

14th Mar 2019, 7:58 AM
Akash kumar
Akash kumar - avatar
3 odpowiedzi
+ 9
int x = 8; // x is now 8 int y = 7; // y is now 7 x++; // x++ is the same as: x = x + 1, so x is now 9 x += y--; // y-- returns y (7) and then decrements y, so x is now 16 // also, then y will be 6
14th Mar 2019, 8:17 AM
Rowsej
Rowsej - avatar
14th Mar 2019, 10:16 AM
Sonic
Sonic - avatar
+ 4
int x = 8; int y = 7; x++; // returns x (8), and then increment value of x // here x is already 9 x += y--; // returns y (7), and then decrement* value of y // 9 + 7 is 16
14th Mar 2019, 8:19 AM
Fermi
Fermi - avatar