Are you running this from the terminal, or from some IDE?
Try running from the terminal. IDEs generally don't provide a program with any console input upon execution (There will, however, be an option to specify input in an IDE too).
Also, your program will continue taking input until you give it a non-integer input.
EDIT: Guess I was late to post.