Adding two numbers without + operator (Clarification)

后端 未结 3 661
北荒
北荒 2020-12-04 16:45

I know that we can use the logic of binary adder where Sum = a XOR b and Carry = a AND b

I have also got a solution:



        
3条回答
  •  不知归路
    2020-12-04 17:24

    Hi don't be think yourself too difficult. Here the simple way to do that.

    Consider a=5, b=10;
    c=a-(-b);
    c=15;
    

    that is it.

提交回复
热议问题