How to calculate the output of following code? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

How to calculate the output of following code?

Var x =1 for(var i=0; i<10; i++){ for(var j=0; j>=2; j++){ for(var k=0; i<5; k++){ x++ } } }

13th Mar 2020, 3:59 PM
Arsham Aazami
Arsham Aazami - avatar
2 Respuestas
+ 2
Why do you have to calculate it? Try to go through the loop in your head or on your paper step by step, like your computer would. (There's no shortcut to understanding these things, you got to think them through.)
13th Mar 2020, 4:08 PM
HonFu
HonFu - avatar
0
Nested loops. K won't stop... it depends on I. But fixed will be 10*3*5=150
13th Mar 2020, 4:11 PM
Amir Galanty
Amir Galanty - avatar