
add any two numbers using bitwise operatorsprint("code sample");

Hi Friend,
Try the following code:
public class AddNumberUsingBitwiseOperators {
public static void main(String[] args) {
System.out.println("Adding 5 and 6......");
int x=5,y=6;
int xor, and, temp;
and = x & y;
xor = x ^ y;
while(and != 0 )
{
and <<= 1;
temp = xor ^ and;
and &= xor;
xor = temp;
}
System.out.println(xor);
}
}
Thanks