previous | start | next

Scanner: Input with a sentinel

Read non-negative integers from standard input until the user enters a value of -1, the sentinel to signal end of input.

Count the values read (not including the sentinel) and print the count and the maximum value read.



previous | start | next