[algogeeks] Re: Multiply 2 nos...

2011-07-21 Thread rShetty
@ankit Could you please explain your code and the logic behind ... Thank You On Jul 21, 6:22 pm, ankit sambyal ankitsamb...@gmail.com wrote: int add(int x, int y) {    int c;    while(y)    {        c = x y;        x ^= y;        y = c 1;    }    return(x);} int mult(int x, int y)

Re: [algogeeks] Re: Multiply 2 nos...

2011-07-21 Thread ankit sambyal
@rShetty : In function add: c=xy; // c has those bits set which have a carry x=x^y; //after this instruction x would contain the result if we had neglected the carry. //Now which positions have a carry can be checked by c by shifting it to left by 1 bit. Thats what we are doing in the next