From 0cc240323a9d34715b4d094cf49b778fc2457db1 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Sat, 13 Nov 2021 00:30:40 -0500 Subject: [PATCH] Exercise 1-12. one word per line --- 10-one-word-per-line.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 10-one-word-per-line.c diff --git a/10-one-word-per-line.c b/10-one-word-per-line.c new file mode 100644 index 0000000..715d79d --- /dev/null +++ b/10-one-word-per-line.c @@ -0,0 +1,14 @@ +#include + +int main() +{ + int c; + + while((c = getchar()) != EOF) { + if (c == ' ' || c == '\n' || c == '\t') + printf("\n"); + else + printf("%c", c); + } + +}