How to use relational operators in c language

program to use relational operators in c language


#include<stdio.h>
int main()
{
    int a,b;
    printf("Enter values for a and b : ");
    scanf("%d%d",&a,&b);
    if(a<b)
    printf("%d is less than %d\n",a,b);
    if(a<=b)
    printf("%d is less than or equal to %d\n",a,b);
    if(a==b)
    printf("%d is equal to %d\n",a,b);
    if(a!=b)
    printf("%d is not equal to %d\n",a,b);
    if(a>b)
    printf("%d is greater than %d\n",a,b);
    if(a>=b)
    printf("%d is greater than or equal to %d\n",a,b);
    return 0;
}

output


Enter values for a and b : 12
45
12 is less than 45
12 is less than or equal to 45
12 is not equal to 45

How to use relation operator in C Language

Program to use relation operator in C Language


#include <stdio.h>
int main()
{
    int a, b;
    printf("enter value for a and b : ");
    scanf("%d%d", &a, &b);

    if (a < b)
    {
        printf("%d is less than %d\n", a, b);
    }
    if (a <= b)
    {
        printf("%d is less than or equal to %d\n", a, b);
    }
    if (a == b)
    {
        printf("%d is equal to %d\n", a, b);
    }
    if (a != b)
    {
        printf("%d is not equal to %d\n", a, b);
    }
    if (a > b)
    {
        printf("%d is greater than %d\n", a, b);
    }
    if (a >= b)
    {
        printf("%d is greater than or equal to %d\n", a, b);
    }
    return 0;
}

output


enter value for a and b :16
7
16 is not equal to 7
16 is greater than 7
16 is greater than or equal to 7