Infinite loop in C, codeblock [closed]

This will fall in the infinite case only in some cases.
And it is because of rounding off you should take x as float so you will get appropriate answer.
In your case first of all U-D will be computed and let’s take a case if
U-D=0.65235
Then..
It will be converted to 0 and added to x
So X will be as it is.. So your loop will go to infinite state..
I have posted a photo below which can help you to understand the reason..

Leave a Comment