exc/k&r/01-a-tutorial-introduction/01-08.c

21 lines
331 B
C
Raw Normal View History

#include <stdio.h>
void main()
{
int c;
long bl, tb, nl;
bl = tb = nl = 0;
while ((c = getchar()) != EOF)
{
if (c == ' ')
++bl;
if (c == '\t')
++tb;
if (c == '\n')
++nl;
}
printf("blanks : %ld\ntabs : %ld\nnewlines : %ld\n", bl, tb, nl);
}