If you are interested in writing computer code that does division,
mimic the algorithm that you learned in elementary school, but in base
2. It will consist of two stages. In the first stage, shift the
divisor left to align it properly with the dividend. In the second
stage, if it is appropriate, put a 1 bit in the correct place in the
quotient, subtract the shifted divisor from the dividend, and shift in
preparation for the next step. When you have shifted the divisor back
to the original place, whatever is left over is the remainder. E.g.,
if you want to write the code in C, you should be able to do it in 20
to 30 lines.

Dave

On Mar 9, 4:22 am, Amritanshu Agrawal <[EMAIL PROTECTED]> wrote:
> Hi All,
> I gave to divide 2 integer number using bitwise opreator.
>
> For Exmaple:
> 12 divided by 6 =  2 quotient
>
> Thnaks in advance
>
> Amritanshu Agrawal
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to