Monday, March 18, 2013
5:04 PM

XOR of Hexadecimals in C program Example

To do XOR in in C the operator used is "^"


#include<stdio.h>
int main()
{
 int x;
 int y;
 int res;
 printf("\n Please enter the value for first number in hex format:");
 scanf("%x",&x); //reading hexadecimal value
 printf("\n Please enter the value for second number in hex format:");
 scanf("%x",&y);
 res=x^y;
 printf("\n The XOR of two numbers is: %x",res);
}

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.