Use the logical AND operator - C Operator

C examples for Operator:Logic Operator

Description

Use the logical AND operator

Demo Code

#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;
}

Result


Related Tutorials