summaryrefslogtreecommitdiff
path: root/one_word.c
diff options
context:
space:
mode:
authorAdam Carpenter <53hornet@gmail.com>2019-05-14 13:30:53 -0400
committerAdam Carpenter <53hornet@gmail.com>2019-05-14 13:30:53 -0400
commit9706f875156e5ce4c08444489b634c54f4d62b52 (patch)
tree706a30846a7237b4eb05d5acfd840fbeba890c22 /one_word.c
parente0ac6e6a3c74f0e4d5936462eaae4d450fa3ed43 (diff)
downloadlearning-c-9706f875156e5ce4c08444489b634c54f4d62b52.tar.xz
learning-c-9706f875156e5ce4c08444489b634c54f4d62b52.zip
Finished 1.16
Diffstat (limited to 'one_word.c')
-rw-r--r--one_word.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/one_word.c b/one_word.c
new file mode 100644
index 0000000..8d50542
--- /dev/null
+++ b/one_word.c
@@ -0,0 +1,16 @@
+#include<stdio.h>
+
+/*
+ * Print input one word per line.
+ */
+main() {
+ int c;
+
+ while ((c = getchar()) != EOF) {
+ if (c == ' ' || c == '\n' || c == '\t')
+ putchar('\n');
+ else {
+ putchar(c);
+ }
+ }
+}