k&r; exercise 1.9 - use putchar instead of printf