Relational Operators

View

These are all binary operators. These operators are used to build conditions. Condition is always either TRUE or FALSE. These operators are used to compare two variables hence they are also known as Comparison operators. Various relational operators are-

 

1.      Less than – Symbol-                                                   <

2.      Greater than – Symbol-                                              >

3.      Less than or equal to – Symbol-                                 < =

4.      Greater than or equal to– Symbol-                             > =

5.      Equal to – Symbol-                                                     = =

6.      Not equal to – Symbol-                                               ! =

Condition- Relational operators are used to build conditions. Condition is always either TRUE or FALSE. In C programming, FALSE is represented by zero ( 0 ) and TRUE is represented any number except zero. But one ( 1 ) is used most commonly to represent TRUE. Condition is always enclosed in brackets (braces). Example-

 Let a= 10, b= 20

Condition                                                              Output

( a < b )                                                                        1

( a > b )                                                                        0

( a = = b )                                                                    0

( a != b )                                                                      1

( a < = b )                                                                    1

( a > = b )                                                                    0         

 


Last modified: Tuesday, 21 September 2021, 9:42 AM