This is down to the way scanf works. When you enter a number you press 1, 0, Enter. scanf reads the 1 and 0, then sees that the next character is Enter, which isn't part of a number, so it stops reading. It converts 1 and 0 to 10. The gets then looks at the input stream, which contains an Enter, so in fact it has read your string, but not the string you thought it was reading.

If you want "10<Enter>" converting to a number, your best bet is to ditch scanf and use gets instead (reading into a temporary string), then use atoi to convert the input string to a number.
smp like this