hi friends i m new to this group, i found very interesting and useful
discussion here....
this is code for adding two number without arithmetic operator
int add(int a, int b)
{
do
{
a=a^b;
b=(a^b)&b;
b=b<<1;
} while(b);
return(a);
}
it is working well for negative numbers also . i tried lot but can not
understand logic behind it can any one explain it in easy manner ...
thanks in advance
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.