Use printf() instead of puts().

puts() outputs an extra newline, making it unsuitable