Output-0000000... Why??? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Output-0000000... Why???

Could someone please tell me why the output of this code is like this??? https://code.sololearn.com/c2J02l1EFexk/?ref=app

22nd May 2018, 4:27 AM
Arjun Ajesh Pillai
Arjun Ajesh Pillai - avatar
5 Réponses
+ 1
because x = 0 it isn't increasing with every iteration of the loop. add x++; in the loop.
22nd May 2018, 4:29 AM
Akib
Akib - avatar
+ 3
3 conditions are necessary for a loop- 1. Initialization (x=0) 2. Termination (x<10) 3. Incrementation (Where is this?)
22nd May 2018, 4:30 AM
Sachin Artani
Sachin Artani - avatar
+ 2
According to the code, X is always 0. So the while statement is excuted eternally.
22nd May 2018, 4:30 AM
Disvolviĝo;
Disvolviĝo; - avatar
+ 1
Ok..now i understand. Thanks everyone.
22nd May 2018, 4:31 AM
Arjun Ajesh Pillai
Arjun Ajesh Pillai - avatar
0
Should i add x++ inside the while loop???
22nd May 2018, 4:30 AM
Arjun Ajesh Pillai
Arjun Ajesh Pillai - avatar