| Operators |
| |
| Logical operators |
| |
| Logical operators are used to combine two or more relational expressions. |
| |
| There are three logical operators: |
| |
| Operator |
Meaning |
| && |
Logical And |
| || |
Logical or |
| ! |
Logical not |
|
| |
| The expression which combines two or more relational expressions is termed as logical expression or compound relational expression. |
| |
| The result of a logical expression is either one or zero. |
| |
| Example: |
| |
| a) if (age > 50 && weight < 80) |
| b) if (a < 0 || ch = = 'a') |
| c) if ( ! (a < 0)) |
| |
| |
|
| |
| |