Control+D is the standard input to signal the end of data. This program demonstrates that after inputting a sequence of values then the user inputs <enter-key> followed by Control+D to terminate the sequence of inputs.
Do not use the poor programming practice of selecting a sentinel value to indicate end of inputs.