+ 1
What is the problem with this code??
It's counting infinitely it is just not working as intended. https://code.sololearn.com/c9hd1E2hBCH2/?ref=app
4 Réponses
+ 4
unsigned int i, it means that the variable i will always be >= 0 (greater or equal). but let's understand this better: it means that i will never be a negative number because it doesn't have a sign.
you can put as condition:
while ( i != 0)
to exit the loop
+ 3
unsigned i = 0;
while (i >= 0)
i++;
this means that i will always be greater or equal to 0 and the loop will never end
+ 2
What about this
https://code.sololearn.com/cD9MdnYzAxUX/?ref=app
+ 2
Oh i see ! Thanks a lot :)