Why this code not available for output | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why this code not available for output

#include <stdio.h> int main() { int x=6; int i=0; while(x>0) { if(x/10==0){ i++; } } printf ("\n %d",i); return 0; }

21st Jul 2019, 11:49 AM
poo malai
poo malai - avatar
3 Answers
+ 2
since the condition need to check if x is less than zero to stop, the value of x need to be decreased where ever you want it to
21st Jul 2019, 12:26 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 12
You have made infinite while() loop. Condition x>0 will always be true,so to correct it you can do some upgradation in value of x inside while() loop to make it a finite loop & avoid "Time limit execedded"
21st Jul 2019, 11:54 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
Anybody answer me
21st Jul 2019, 11:50 AM
poo malai
poo malai - avatar