+ 1

Can anybody explain this to me

How many times will the following loop run? for(int i=2;i<10;i=i*i){ System.out.println(i) }

30th Mar 2022, 8:13 PM
Otman AFOUFOU
Otman AFOUFOU - avatar
3 Respostas
+ 8
Pro tip: Copy the code into a script on playground and find out by yourself how many times the loop will run! Add the missing ; at the end of the println
30th Mar 2022, 8:21 PM
Lisa
Lisa - avatar
+ 1
You can use a debugger to see how the code works and the variables change through the flow of the code
30th Mar 2022, 11:44 PM
Mazen Ibrahim
Mazen Ibrahim - avatar