C examples for Operator:Logic Operator
Use the logical AND operator
#include <stdio.h> #define PERIOD '.' int main(void) { char ch;/*from ww w . j a v a 2 s . c om*/ int charcount = 0; while ((ch = getchar()) != PERIOD) { if (ch != '"' && ch != '\'') charcount++; } printf("There are %d non-quote characters.\n", charcount); return 0; }