0

On the screenshot is the result after I typed a negative integer. How do I ignore the negative integers on bottles' result? Help pls.

The positive & zero results are just fine, but the negatives are not finishing the do-while loop to prompt the user another digits for minutes. What is wrong here please?

TIA

code screenshot

1
  • You've had an answer. :) But keep in mind that the spec specifically says that you can assume that only positive integers will be given, so there is no need for any checking loop.
    – curiouskiwi
    Jun 22, 2017 at 20:49

1 Answer 1

0

The idea is to use a DO-WHILE loop as you do in your program but we will use it when ordering an integer with the function get_int():

do 
{
    printf("Enter an integer"
    minutes = get_int()
}
while(minutes < 0)

The loop will be repeated while minutes are less than zero, the rest of the program should not go inside a loop

0

You must log in to answer this question.

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