You can't exactly read the user's mind and know they are going to input another integer, but you might be able to require that the user will separate the numbers by spaces and terminate the input with a newline. That way, you read until you hit a newline and know that once you get that, that is all the user is planning to input.