C Language

May 26, 2023

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

by : Ajaj Khan

Quick Summary:

program to use relational operators in c language copy #include&ltstdio.h> int main() { int a,b; printf(“Enter values for a and b : “); scanf(“%d%d”,&a,&b); if(a&ltb) printf(“%d is less than %d\n”,a,b); if(a&lt=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&gtb) printf(“%d is […]