Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Relational Operators in c

// Working of relational operators
#include <stdio.h>
int main()
{
    int a = 5, b = 5, c = 10;

    printf("%d == %d is %d 
", a, b, a == b);
    printf("%d == %d is %d 
", a, c, a == c);
    printf("%d > %d is %d 
", a, b, a > b);
    printf("%d > %d is %d 
", a, c, a > c);
    printf("%d < %d is %d 
", a, b, a < b);
    printf("%d < %d is %d 
", a, c, a < c);
    printf("%d != %d is %d 
", a, b, a != b);
    printf("%d != %d is %d 
", a, c, a != c);
    printf("%d >= %d is %d 
", a, b, a >= b);
    printf("%d >= %d is %d 
", a, c, a >= c);
    printf("%d <= %d is %d 
", a, b, a <= b);
    printf("%d <= %d is %d 
", a, c, a <= c);
  
//Output

//5 == 5 is 1
//5 == 10 is 0
//5 > 5 is 0
//5 > 10 is 0
//5 < 5 is 0
//5 < 10 is 1
//5 != 5 is 0
//5 != 10 is 1
//5 >= 5 is 1
//5 >= 10 is 0
//5 <= 5 is 1
//5 <= 10 is 1 
    return 0;
}
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #Relational #Operators
ADD COMMENT
Topic
Name
1+4 =