It's the newline you enter for the input. It has the ASCII value 10.
Here are three ways of "stopping" it:
Add an
if
check in the loop to check for it, and print only when it's not a newline.Use
fgets
to read one complete line at a time, remove the newline from the string (fgets
adds it) and loop over the string and print each character.Use
scanf
to read a character. With a leading space in the format it will skip whitespace like newlines.
The first method can be used to check for unprintable characters as well (see isprint
), and other classes of characters if you want to do special printing for them (look at these character classification functions).