Operator | Meaning of Operator | Example | Description |
---|---|---|---|
&& | Logical AND | If c=5 and d=2 then,((c==5) && (d>1)) returns true. | It returns true when both conditions are true |
|| | Logical OR | If c=5 and d=2 then, ((c==5) || (d>5)) returns true. | It returns true when atleast one of the condition is true |
! | Logical NOT | If c=5 then, ! (c==5) returns false | If condition is true it returns false |
#include<stdio.h>
#include<conio.h>
void main ( )
{
printf(“\n In 5>3 && 5<10 : %3d”, 5>3&&5<10);
printf(“ \n In 8<5 || 5= =5 : % 3d”, 8<5 || 5= =5);
printf(“\n In !(8 = =8) : %3d”, !(8= =8)) ;
}
In 5>3 && 5<10 : 1
In 8<5 || 5= =5 : 1
In !(8 = =8) : 0