And gate Or gate Xor gate
0 0 0 0 0 0 0 0 0
0 1 0 0 1 1 1
1 0 0 1 1
1 1 1 1 1 1 0
BITWISE OPERATORS
& Bitwise AND
| Bitwise OR
^ Bitwise XOR
~ Bitwise complement
<< Shift left
>> Shift right
LOGICAL OPERATORS
&& Logical AND. True only if all operands are true If c = 5 and d = 2 then, expression ((c==5) && (d>5)) equals to 0.
|| Logical OR. True only if either one operand is true If c = 5 and d = 2 then, expression ((c==5) || (d>5)) equals to 1.
! Logical NOT. True only if the operand is 0 If c = 5 then, expression !(c==5) equals to 0.
ARITHMATIC OPERATORS
+ addition or unary plus
- subtraction or unary minus
* multiplication
/ division
% remainder after division (modulo division)
ASSIGNMENT OPERATORS
= a = b a = b
+= a += b a = a+b
-= a -= b a = a-b
*= a *= b a = a*b
/= a /= b a = a/b
%= a %= b a = a%b
RELATIONAL OPERATORS
== Equal to 5 == 3 is evaluated to 0
> Greater than 5 > 3 is evaluated to 1
< Less than 5 < 3 is evaluated to 0
!= Not equal to 5 != 3 is evaluated to 1
>= Greater than or equal to 5 >= 3 is evaluated to 1
<= Less than or equal to 5 <= 3 is evaluated to 0
for logical && operator
age=18
if(age>=13 && age<=19)
printf("%d is a teenage value\n", age);
else
printf("%d is not a teenage value\n", age);
-> 18 is a teenage value
To embed this program on your website, copy the following code and paste it into your website's HTML: