summaryrefslogtreecommitdiff
path: root/ex1-8.c
diff options
context:
space:
mode:
Diffstat (limited to 'ex1-8.c')
-rw-r--r--ex1-8.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ex1-8.c b/ex1-8.c
new file mode 100644
index 0000000..b692948
--- /dev/null
+++ b/ex1-8.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+int main(void) {
+ int c;
+ uint32_t nl = 0, tb = 0, bl = 0;
+ while ((c = getchar()) != EOF) {
+ if (c == ' ') {
+ bl++;
+ } else if (c == '\n') {
+ nl++;
+ } else if (c == '\t') {
+ tb++;
+ }
+ }
+ printf("nl=%ld tb=%ld bl=%ld\n", nl, tb, bl);
+ return 0;
+} \ No newline at end of file