A relational operator checks the relationship between two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0. Relational Operators are a bunch of binary operators that are used to check for relations between two operands including equality, greater than, less than, etc. They return a boolean result after the comparison and are extensively used in looping statements as well as conditional if-else statements and so on.
Operator | uses |
---|---|
> | greater than operator |
< | less than operator |
<= | less than or equal to operator |
>= | greater than or equal to operator |
== | equality operator |
The code is a C program that demonstrates the use of relational operators in C. Here is an explanation of each line of the code:
When you run this code, it will perform relational operations on variables and print the results in the console.
//Relational Operators #include<stdio.h> int main() { int a=10,b=5; printf("Greater Than : %d",a>b); printf("\nLess Than : %d",a<b); printf("\nGreater Than or Equal : %d",a>=b); printf("\nLesser Than or Equal : %d",a<=b); printf("\nEqual : %d",a==b); return 0; }To download raw file Click Here
Greater Than : 1 Less Than : 0 Greater Than or Equal : 1 Lesser Than or Equal : 0 Equal : 0
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions