Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

addition without arithmetic operators c++

int getSum(int a, int b) {
        while(b!=0){
            unsigned c = (a&b)<<1;
            a = a^b;
            b = c;
        }
        return a;
}
 
PREVIOUS NEXT
Tagged: #addition #arithmetic #operators
ADD COMMENT
Topic
Name
8+5 =