0
Output? Can u elaborate output of the code
int i; for(i=1;i<5;i++) i*=i; System.out.println(i);
1 Resposta
0
Iteration 1: i=1
Statement 1: i*=i on execution i = i*i which is i= 1*1 which gives you i = 1
i++
check whether i<5 or not? It is then
Iteration 2: i=2
Statement 1: i*=i which is i = 2*2 which gives you i=4
check whether i<5 or not? 5<5 which is false
loop breaks
Now Statement 2: print i
which is equal to 5
Output of this code will be 5