Answers for "how can we find sum of two numbers using bitwise operators"

1

add two numbers bitwise

public class Bitwise_Addition{
    int add(int a, int b){
        int c;
    while(b!=0){
        c=a&b;
        a=a^b;
        b=c<<1;
        }
    return a;
    }
}
Posted by: Guest on May-03-2020

Code answers related to "how can we find sum of two numbers using bitwise operators"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language