Code Review for Adding two numbers without using the + operator
Your algorithm looks good, but the best algorithm (as far as I know) is following:


Add 2 binary numbers without considering carry (an xor operation)
Construct the difference with the actual solution, i.e., construct a number in the carry positions (a and operation then a left shift)
Add the result of step 1 with step 2 (by recursion), until step2 is 0.


The code will look like this:

int add(int a, int b) {
    if (b == 0) return a;
    return add(a ^ b, (a &amp; b) &lt;&lt; 1);
}