From the standard (but with my emphasis):
A directive composed of white-space character(s) is executed by reading input up to the first nonwhite-space character (which remains unread), or until no more characters can be read.
That means your trailing white-space directive cannot be satisfied until it detects a non-space in the input stream, which it will leave there for the next input attempt. And you certainly don't need both the space and the newline, since the latter will simply look at the same character the former did and read nothing :-)
If you had entered 120
, ENTER, x
, ENTER, you would have seen it continue (with the x
being left in the input stream).
In fact, you would be better off just using "%d"
as the input specifier. This already ignores leading white-space before attempting to read the number (meaning the initail space is unnecessary), and you should not usually concern yourself with what follows the thing you're reading.