+ 1
15th Jan 2020, 8:50 AM
Akshay Harshora
Akshay Harshora - avatar
3 odpowiedzi
+ 1
x-=-(++x)-x For example if x=5 The new value of x will be: X-=-(6)-5 // (6) because of (++x) x-=-6-5 x-=-11 X-= means that whatever value is on the left side of = will be subtracted from the value of x, the answer will be the new value of x: x=x-(-11) X=5-(-11) X=16
15th Jan 2020, 9:38 AM
PROMETHEUS
PROMETHEUS - avatar
+ 2
public class Program { public static void main(String[] args) { int x = 0; for(x=1;x<10;x++) { if(x==6) { System.out.print(++x); } if(x==9) { System.out.print(x--); } x -=-(++x)-x; } } } When x is equal to 6, the condition (if (x==6)) becomes true and it's executed. Instead of printing 6, the value of x (6) is first incremented by 1 because of (++x)...
15th Jan 2020, 9:02 AM
PROMETHEUS
PROMETHEUS - avatar
+ 2
I can not understand x-=-(++x)-x
15th Jan 2020, 9:03 AM
Akshay Harshora
Akshay Harshora - avatar