XOR (^)

the truth table for the Xor operation.

0 ^0  =0  //   when digits are equals then we put  0

 

0 ^ 1=  1 //  when  digits are dis similiar then we put 1

1 ^ 0= 1     // when digits are  dis similiar  then we put 1

1 ^ 1= 1   // when digits are similiar we put 0.

lets understand with code.

#include <stduio.h>

#include<conio.h>

void main()

{

int x;

x=3^2;

printf(“%d”,x);

getch();

 

 

 

}

output =1

lets understand with examples

3 the binary value of 3= 011

2 the binary value of 2=010

so after performin the xor operation between these two binary digit we get.

0 1  1  the binary value of 3

0  1  0 the binary value of 2

001  after performing xor operation we get 1.

thank you hope you will like it and get benefited thankyou enjoy.

 

Leave a Reply

Your email address will not be published. Required fields are marked *