Possible Duplicate:
exiting a while loop with a negative integer
I want the user to enter few different numbers numbers, and after that to test each number separately.
Also I need to terminate the program ONLY when the number 0 entered.
This is the beginning of my code:
int userInput;
printf("please enter some numbers: \n");
while ((scanf("%d", &userInput)) == 1)
{
...
}
How can I keep getting input from the user until 0 is entered?
1 Answer