How the value of count is 11 | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
11th Mar 2021, 4:54 AM
Ankit Kumar
Ankit Kumar - avatar
2 Respuestas
+ 1
the syntax is wrong for the second for loop and i<=10 means it will go till ten then when it goes inside the loop with 10 it count++ increments So 10 becomes 11
11th Mar 2021, 5:09 AM
Sharique Khan
Sharique Khan - avatar
+ 1
Your both loops are altering same loop variable (*i*), so by the end of the first loop, the value of *i* is 11 already, and then program also goes out of outer loop also.
11th Mar 2021, 5:19 AM
Arsenic
Arsenic - avatar