To Add two integer you can use full adder at bit level.
if bit1 and bit2 are kth bits and car is previous carry then
sum = bit1 ^ bit2 ^ carry;
carry = bit1.carry + bit2.carry + bit1.bit2;
here ^ = bitwise zor
. = bitwise and
+ = bitwise or
repeat it for all bits of two integer, initially prev carry will be 0;
On Mon, Sep 7, 2009 at 7:01 AM, ritter <[email protected]> wrote:
>
> how to add two integers without using arithmetic operators?
> can anyone help me.
>
> >
>
--
GAURAV GUPTA
B.Tech IV Yr. , Department of Computer Science & Engineering
IT BHU , Varanasi
Contacts
Phone No: +91-99569-49491
e-mail :
[email protected]
[email protected]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---