1
0
mirror of https://github.com/krislamo/knrc.git synced 2024-11-10 00:30:35 +00:00
knrc/06-line-count.c

22 lines
282 B
C
Raw Normal View History

2021-11-09 05:36:42 +00:00
#include <stdio.h>
int main()
{
int c, b, t, n;
2021-11-09 05:36:42 +00:00
b = 0;
t = 0;
n = 0;
while ((c = getchar ()) != EOF) {
if (c == ' ')
++b;
if (c == '\t')
++t;
2021-11-09 05:36:42 +00:00
if (c == '\n')
++n;
}
printf("blanks = %d\n", b);
printf("tabs = %d\n", t);
printf("newlines = %d\n", n);
2021-11-09 05:36:42 +00:00
}