2. Relational Operators
Often it is required to compare the relationship
between operands and bring out a decision and program accordingly. This is when
the relational operator come into picture. C supports the following relational
operato rs.
It
is required to compare the marks of 2 students, salary of 2 persons, we can
compare them using relational operators.
A simple relational expression contains only one relational operator and takes the following form.
exp1 relational operator exp2
Where exp1 and exp2 are expressions, which may be simple constants, variables or combination of them. Given below is a list of examples of relational expressions and evaluated values.
6.5 <= 25 TRUE
-65 > 0 FALSE
10 < 7 + 5 TRUE
Relational expressions are used in decision making statements of C language such as if, while and for statements to decide the course of action of a running program.
A simple relational expression contains only one relational operator and takes the following form.
exp1 relational operator exp2
Where exp1 and exp2 are expressions, which may be simple constants, variables or combination of them. Given below is a list of examples of relational expressions and evaluated values.
6.5 <= 25 TRUE
-65 > 0 FALSE
10 < 7 + 5 TRUE
Relational expressions are used in decision making statements of C language such as if, while and for statements to decide the course of action of a running program.
No comments:
Post a Comment