how many time the following loop run ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

how many time the following loop run ?

for (int i =2; i < 10; i = i*i) { System.out.println(i); }

22nd Jun 2019, 2:36 PM
Boy Arya
Boy Arya - avatar
3 Answers
0
Two times.
22nd Jun 2019, 2:43 PM
Airree
Airree - avatar
0
i = 2 -> print 2 2 * 2 = 4 -> print 4 4 * 4 = 16 end loop You should use the code playground for such questions.
22nd Jun 2019, 4:06 PM
Denise Roßberg
Denise Roßberg - avatar
0
2
9th Jun 2022, 12:19 PM
Piumi Wijenayake
Piumi Wijenayake - avatar