I am reading the slides for the Section 1 (2014) which I downloaded from here. (I cannot view the video because of less bandwidth). I am on this page (28):

The condition given in the code is that we can exit the loop iff

input >= 1

but the prompt for input says

"Enter a positive number: "

So should the condition at end of the loop not be while (input<0) or the text be "Enter a number greater than or equal to 1?"

Have I missed something?

  • Whoever downvoted, please tell me the reason so that I can improve my question. – Kartik Aug 28 '14 at 16:05

According to this wikipedia entry:

The number 0 is neither positive nor negative and appears in the middle of a number line.

So asking for a positive number does in fact exclude zero.

  • Ok, but I thought that 0 is both negative and positive. Thank you for clearing the confusion. – Kartik Aug 28 '14 at 16:03

You must log in to answer this question.

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