Which programming language?
If you are looking to do it in shell script, it is wise to use the "-n" flag to "echo" (depending on your shell, it's either builtin (consult your shell's manpage) or uses an external program (consult "man echo" -- though this is rare these days)).
The "-n" flag keeps "echo" from outputting a newline.
Cheers,
~kj