> Online tutorial : compare two number without using relational operator in c
Showing posts with label compare two number without using relational operator in c. Show all posts
Showing posts with label compare two number without using relational operator in c. Show all posts

compare two number without using relational operator in c

#include<stdio.h>
#include<conio.h>
int main () {
{
int a,b;
printf ( "enter the two values u like to compare\n");
scanf (" %d %d",&a,&b);

if (!(a ^ b))

// ^ is Xor operator.
Xor operator function below


valuesvlauesOutput
000
011
101
110


printf ("both are equal\n");
else
printf ("both are not equal\n");
}

Output
Enter the value
10
15
Both are not equals