int main(int argc,char *argv[]){
int a=atoi(argv[1]),b=atoi(argv[2]),sum,carry;
sum = a^b;
carry = a&b;
while(carry){
carry = carry << 1;
int newsum = sum ^ carry;
carry = sum & carry;
sum = newsum;
}
printf("Output is %d+%d=%dn",a,b,sum);
}
When curiosity outbursts …!!!
int main(int argc,char *argv[]){
int a=atoi(argv[1]),b=atoi(argv[2]),sum,carry;
sum = a^b;
carry = a&b;
while(carry){
carry = carry << 1;
int newsum = sum ^ carry;
carry = sum & carry;
sum = newsum;
}
printf("Output is %d+%d=%dn",a,b,sum);
}