chcount.c 336 B

1234567891011121314151617
  1. // chcount.c -- use the logical AND operator
  2. #include <stdio.h>
  3. #define PERIOD '.'
  4. int main(void)
  5. {
  6. char ch;
  7. int charcount = 0;
  8. while ((ch = getchar()) != PERIOD)
  9. {
  10. if (ch != '"' && ch != '\'')
  11. charcount++;
  12. }
  13. printf("There are %d non-quote characters.\n", charcount);
  14. return 0;
  15. }