×
☰ Menu

Logical Operators

 

Operator

 Meaning 

&& logical AND
|| logical OR
! logical NOT

 

 

Code: 

#include <stdio.h>
main() 
{
   int a = 21, b=10, c;
   c=(a>b && a<b);
printf("%d\n", c );
	c=(a>b || a<b);
printf("%d\n", c );	
	c=!(a>b || a<b);
printf("%d\n", c );
}

Output: 

0
1
0

--------------------------------
Process exited after 1.843 seconds with return value 0
Press any key to continue . . .