How to wriite a program that input three numbers from user. All numbers Must be positive, if user enters a negative number, your program should keep asking user to enter a positive number until user enters a positive number?
Asked
Active
Viewed 42 times
-5
-
3We don't do homework for people. You need to try writing this yourself, and ask questions. – Ned Batchelder Apr 20 '19 at 22:25
-
Hi Rana, just to echo what Ned has said. This seems like a homework question. Please let us know what kind of things you have tried before asking for help on StackOverflow. – Games Brainiac Apr 20 '19 at 22:26
-
You can use a while loop for this purpose.As others have said, writing the answer would be like doing your homework, but use while and you'll be fine. – Leo Apr 20 '19 at 22:32
1 Answers
1
Because others have said not to do others' homework, I will instead make my answer this:
Use a while
loop to make sure the input is negative.
Use a for
loop to repeat this three times.

kleinbottle4
- 151
- 5