i tried with the following code , but i can\'t understand why it\'s giving me wrong answer. i am computing the 2\'s complement and adding with another no.
#inclu
i used a different add() function as suggested by NullUserException, it works now:
int add(int a,int b) { int x; x = a^b; while(a&b) { b = ((a&b)<<1); a = x; x = a^b; //b=(a^b); } return x; }