I am having a problem with my do while loop.

    //this thing
while (n < 0 && n > 23);

when I run it every time I enter a number ether valid or invalid it ends my program.

1 Answer 1


This loop will run exactly once every time. Look at your test. It has to be true for the loop to execute more than once, but that will never happen. What number can be less than zero AND greater than 23 AT THE SAME TIME? ;-)

If this answers your question, please click on the check to accept. Let's keep up on forum housekeeping. ;-)

  • Ahh there it is. Thank you that was it! Sep 12, 2015 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .