C program to perform the relational operations
Algorithm
Step 1: Start
Step 2: Initialize a = 0 and b = 1 
Step 3: Print the values of a and b
Step 4: Print the results of relational operations
        (a != b), (a > b), (a >= b), (a == b), and (a < b) 
Step 5: End
kw.c
#include <stdio.h>
int main()
{
    int a = 0, b = 1;
    printf("———————————————————————————————————————————");
    printf("\nProgram to perform relational operations");
    printf("\n———————————————————————————————————————————");
    printf("\nValue of a     | %d ", a);
    printf("\nValue of b     | %d ", b);
    printf("\nValue of %d!=%d  | %d ", a, b, (a != b));
    printf("\nValue of %d> %d  | %d ", a, b, (a > b));
    printf("\nValue of %d>=%d  | %d ", a, b, (a >= b));
    printf("\nValue of %d==%d  | %d ", a, b, (a == b));
    printf("\nValue of %d< %d  | %d ", a, b, (a < b));
    printf("\n———————————————————————————————————————————\n");
    return 0;
}
Output
kodingwindow@kw:~$ gcc kw.c
kodingwindow@kw:~$ ./a.out ——————————————————————————————————————————— Program to perform relational operations ——————————————————————————————————————————— Value of a | 0 Value of b | 1 Value of 0!=1 | 1 Value of 0> 1 | 0 Value of 0>=1 | 0 Value of 0==1 | 0 Value of 0< 1 | 1 ——————————————————————————————————————————— kodingwindow@kw:~$
Advertisement