Relational Operators

Here You Will Learn about Relational Operators.

Relational Operators?
Relational operators are used to comparing the values of two expressions. Relational operators are binary operators because they require two operands to operate. An expression that contains the relational operators is called relational expression. If the relation is true then the result of the relational expression is 1, if the relation is false then the result of the relational expression is 0.





Example:-
#include<stdio.h>
void main()
 {
    int a,b,c;
    a=5;
    b=5;
    c = a==b;
    printf("a==b : %d\n",c);//1

    c = a!=b;
    printf("a!=b : %d\n",c);//0

    c = a > b;
    printf("a > b : %d\n",c); //0

    c = a < b;
    printf("a < b : %d\n",c);//0

    c = a >= b;
    printf("a >= b : %d\n",c);//1


    c = a <= b;
    printf("a <= b : %d\n",c);//1
 }

OUTPUT
a==b : 1
a!=b : 0
a > b : 0
a < b : 0
a >= b : 1
a <= b : 1
  
Comment below if you have any queries related to the above tutorial for Relational Operators of C Programming.

Post a Comment

0 Comments