in reply to CAN YOU FIGURE THIS OUT?

This isn't even that well-written a question. What the hell does "floating point or decimal number" mean? What if the difference between the two endpoints is not an integer multiple of the increment?

By the way, I don't actually recommend deleting the OP here (yes, I voted for it but I changed my mind). It's nice to have a blatant, unambiguous homework example to point to for reference, especially since we've had some disputed incidents of homework SOPWs recently.

Replies are listed 'Best First'.
Re^2: CAN YOU FIGURE THIS OUT?
by jhourcle (Prior) on Mar 30, 2005 at 04:17 UTC

    I know I'm new here, but I could I propose that we give it two weeks (just to make sure we allow for the possibility of spring break, and we assume that something this simplistic wouldn't be a multi-week assignment), and then see who can come up with the most creative solution, that meets all of the requirements, and yet would still fail spectacularly under realistic conditions. (and you've already suggested at least one failure scenario, but there's just sooo many more.)

      I choice for "meets all of the requirements, and yet would still fail spectacularly" would be falling into an infinite loop when the increment is 0.
      Sounds like a decent idea to me. I'll try to remember to come back and update my note.