## Logical operators in c++ with example

 Operator Meaning < less than <= less than or equal to > greater than >= greater than or equal to == equal to != not equal to && logical AND || logical OR ! logical NOT

The above 1st 6 are relational operators in c++ and last 3 are logical operators

The relation operators are used to compare 2 values. The output of relational operators is either true (1) or false (0)

Syntax:-

value1 relational_operator value2

Example:-

2 < 10     True
3 > 8       False
7.5>=5    True

value1 and value2 are can be constants, variable or combination of them.

Relation operator are used in if-else or in loop statement.

Example:-

Program to find Greatest number between 2

Logical operators:-

logical operators && and || are used to when we want to check 2 or more condition statement.

Example

8 > 7 && 5 < 8      True
8 < 5 || 8 < 9           False
7 > 2 && 19 < 2    False

AND (&&) operator output is true only when either condition statement is true.
OR (||) operator output is false only when either condition statement is false.

Truth table:-

 A B AND 0 0 0 0 1 0 1 0 0 1 1 1

 A B OR 0 0 0 0 1 1 1 0 1 1 1 1

NOT (!)  logical operator is used for compliment condition statement outputs.

Truth table:-

 A NOT 0 1 1 0

Example:-

Program to solve following problem
The candidate is selected if his age and height is 18 and 5 and more respectively.

Java program for logical NOT
Program to find max number between 2

Previous Code:-
Arithmetic operators

List Code:-
C++ Codes

Next Code:-
Bitwise operator

C++ Programs
List of c++ Programs

1. This is good

2. Give examples of Logical Not! operator to understand,,
5+6!=5

3. what the fuck is this bullshit where is logical operators examples 