From 62482c2d0d6b2080d51fe6ea03e2ccd93e3351e0 Mon Sep 17 00:00:00 2001 From: "martin@ashbysoft.com" Date: Sat, 11 Jun 2022 20:39:06 +0000 Subject: ex1-8 --- ex1-8.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ex1-8.c 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 + +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 -- cgit v1.2.3-ZIG