Answers for "how to find the sum of two numbers without addition or subtraction"

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 to find the sum of two numbers without addition or subtraction"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language