- 1
how many time the following loop run ?
for (int i =2; i < 10; i = i*i) { System.out.println(i); }
3 Respuestas
0
Two times.
0
i = 2 -> print 2
2 * 2 = 4 -> print 4
4 * 4 = 16 end loop
You should use the code playground for such questions.
0
2
for (int i =2; i < 10; i = i*i) { System.out.println(i); }