Logical Operators

Logical operators return Boolean results (true or false) and take Boolean values as operands. While performing Boolean logic, the expression on the left is evaluated, followed by the expression on the right. The two expressions are finally evaluated in the context of the Boolean logical operator between them. The return value is of Boolean type and based on the operator type used.




1.write a program to show Logical Operators operation.

#include<stdio.h>
void main()
{
    int a=0,b=1,AND_status,OR_status,NOT_status;
    AND_status=a && b;
    OR_status=a || b;
    NOT_status=!(a && b);
    printf("%d && %d is %d\n",a,b,AND_status);
    printf("%d || %d is %d\n",a,b,OR_status);
    printf("!(%d && %d) is %d\n",a,b,NOT_status);
}

Output: