12345678910111213141516171819202122232425 |
- #include <stdio.h>
- /* count characters in input; 2nd version */
- int main()
- {
- long int blank=0;
- long int nl=0;
- long int tab=0;
- char c=(char)1;
-
- while( c != EOF )
- {
- c = getchar();
- if (c==' ')
- blank++;
- if (c=='\t')
- tab++;
- if (c=='\n')
- nl++;
- }
- printf("spaces: %ld tabs: %ld lines: %ld ",blank, tab, nl);
- return (0);
- }
|