0
(x*=i) what this statement do ? explain plz
int x = 1; for(i=1;i <10;i++) { x*=i; } System.out.println (x);
3 odpowiedzi
+ 11
x *= i; => x = x * i;
Above code prints 1*2*3*4*5*6*7*8*9*10 = 10!
+ 1
x *= i; is a shorter way of writing x = x * i;. They both do the exact same thing, really, but it makes the code just a tad bit easier to maintain.
0
thanks☺