Refer half adder :)

*sum = a ^ b;
carry = a & b;
while (carry != 0)
{
carry <<= 1;
a = sum;
b = carry;
sum = a ^ b;
carry = a & b;
}*

On Sat, Aug 20, 2011 at 9:32 PM, Sanjay Rajpal <srn...@gmail.com> wrote:

> Hey frnds,
>
> I am stuck in a problem of adding two numbers using bitwise operators only.
>
> An explanation is required.
>
>
> Sanju
> :)
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to