Relational Operators in C Language
In this topic of Relational operators in C Language , we will list Relational operators available in C Language. Like other programming languages, C Language also have Relational operators to perform various relational operations like less than, greater than, equal to , not equal to etc.
Relational Operators in C Language |
Lets us explore all the C Language Relational operators one by one.
Less than (<) Operator of C language
This is one of the Relational Operators of C language.
To check which value is less among two values, we can use less than(<) operator .
For Example
Suppose value of A =5, value of B=15
We can check if value of A is less than B or not.
For this we have to use if statement like this, if(A<B)
For above values of A and B, the result will True.
If the value of A=15 and B=5, then the result will be False.
Greater than (>) Operator of C language
To check which value is greater among two values, we can use greater than(>) operator .
For Example
Suppose value of A =5, value of B=15
We can check if value of A is greater than B or not.
For this we have to use if statement like this, if(A>B)
For above values of A and B, the result will False.
If the value of A=15 and B=5, then the result will be True.
Less than or equal to (<=) Operator of C language
To perform this operation, we will <= operator.
For Example
Suppose value of A =5, value of B=15
We can check if value of A is less than or equal to B or not.
For this we have to use if statement like this, if(A<=B)
For above values of A and B, the result will True.
If the value of A=15 and B=5, then the result will be False.
Greater than or equal to (>=) Operator of C language
To perform this operation, we will >= operator.
For Example
Suppose value of A =5, value of B=15
We can check if value of A is less than or equal to B or not.
For this we have to use if statement like this, if(A>=B)
For above values of A and B, the result will False.
If the value of A=15 and B=5, then the result will be True.
Equal to (==)Operator of C language
The equal to operator is useful to check the equality of two values.
For Example
Suppose value of A =5, value of B=15
We can check if value of A is equal to B or not.
For this we have to use if statement like this, if(A==B)
For above values of A and B, the result will False.
If the value of A=5 and B=5, then the result will be True.
Not Equal to (!=)Operator of C language
The equal to operator is useful to check the in equality of two values.
For Example
Suppose value of A =5, value of B=15
We can check if value of A is equal to B or not.
For this we have to use if statement like this, if(A!=B)
For above values of A and B, the result will True.
If the value of A=5 and B=5, then the result will be False.