That's simple.

A [XOR] B = 0 if A == B
A [XOR] B != 0 if A != B

Code: C
if(A^B) {printf("%d != %d\n",A,B);}
else      {printf("%d == %d\n",A,B);}