Professional Documents
Culture Documents
RELATIONAL OPERATOR
Boolean Expression
LOGICAL OPERATORS
• When there is more than one RELATIONAL EXPRESSION
at a time, LOGICAL OPERATOR are used to perform the
evaluation.
• To perform logical operations, logical operator to be
used are shown below:
Logical operations Operators Example
OR || (a==b) || (a==c)
LOGICAL OPERATORS
Truth Table
• A truth table is used to specify the conditions that make a
logical operation true and false.
• A truth table lists all possible combinations of operand values
and the result of the operation for each combination.
• The truth table for logical operation is summarized below:
X Y X && Y X || Y !X
(both X and Y must be (either X or Y must be (produces the
TRUE) TRUE) opposite relation)
True True True True False
True False False True False
False True False True True
False False False False True
OPERATOR
• Example:
a = 5;
• Assigns the integer value 5 to variable a.
• The part at the left of the = operator is known as
lvalue (left value) and the right one as rvalue
(right value).
• lvalue must always be a variable whereas the
right side can be either a constant, a variable,
the result of an operation or any combination of
them.
• It is necessary to emphasize that the assignation
operation always takes place from RIGHT TO
LEFT and NEVER AT THE INVERSE.
TEST AND DEBUG THE
PROGRAM