/** Solution to exercise 5.1, p. 198, "C by Dissection" * * * Reads a character from the keyboard and writes to the screen. Every letter * that is read is written three times, followed by newline * * 07. March, Lone Leth Thomsen **/ #include <stdio.h> int main(void) { char c; while((c = getchar()) != EOF) { if (c!='\n'){ putchar(c); putchar(c); putchar(c); putchar('\n'); } } return 0; }
![]() | while((c = getchar()) != EOF) { |
reads a character and checks that it is not EOF |
![]() | if (c!='\n'){ |
checks that the character is not newline |