标签:
public int Add(int num1,int num2) { if(num1 == 0 && num2==0) return 0; if(num1 !=0 &&num2==0) return num1; if(num1==0&&num2!=0) return num2; int sum=0; int carray=0; do{ sum = num1^num2; carray = (num1&num2)<<1; num1 = sum; num2 = carray; }while(num2!=0); return sum; }
标签:
原文地址:http://www.cnblogs.com/yingpu/p/5832248.html