diff options
author | martin@ashbysoft.com <martin@ashbysoft.com> | 2022-06-11 20:39:06 +0000 |
---|---|---|
committer | martin@ashbysoft.com <martin@ashbysoft.com> | 2022-06-11 20:39:06 +0000 |
commit | 62482c2d0d6b2080d51fe6ea03e2ccd93e3351e0 (patch) | |
tree | 11ee49a45d0c4aa87bafe5edf0776ced1e8c20c8 /ex1-8.c | |
parent | c813f7bd522baf1057ba9bee874669ea5b945a66 (diff) | |
download | learn-c-62482c2d0d6b2080d51fe6ea03e2ccd93e3351e0.tar.gz learn-c-62482c2d0d6b2080d51fe6ea03e2ccd93e3351e0.tar.bz2 learn-c-62482c2d0d6b2080d51fe6ea03e2ccd93e3351e0.tar.xz learn-c-62482c2d0d6b2080d51fe6ea03e2ccd93e3351e0.zip |
ex1-8
Diffstat (limited to 'ex1-8.c')
-rw-r--r-- | ex1-8.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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 |