Answer:
10.0. The variable would start out at 0.0, and would have 0.1 added to it until it reached 9.9. This is less than the limit, so 0.1 would be added to make 10.0. The loop then would exit.
But the variable actually ends up as
10.09999999999998.
Single precision floating point is really not very accurate. But even double precision floating point has errors. If you are not cautious with floats, your program may go belly up.
End of the Chapter
I hope you were not counting on more, because this is the end of the chapter. You may wish to review the following.
- Counting upwards by two.
- Loop condition as a gatekeeper
- Iteration
- Decrementing the Loop Control Variable.
- An Infinite Loop.
- Why the Loop Control Variable should be an integer.