1.7.c 375 B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. /* count characters in input; 2nd version */
  3. int main()
  4. {
  5. long int blank=0;
  6. long int nl=0;
  7. long int tab=0;
  8. char c=(char)1;
  9. while( c != EOF )
  10. {
  11. c = getchar();
  12. if (c==' ')
  13. blank++;
  14. if (c=='\t')
  15. tab++;
  16. if (c=='\n')
  17. nl++;
  18. }
  19. printf("spaces: %ld tabs: %ld lines: %ld ",blank, tab, nl);
  20. return (0);
  21. }