How to write a program
?Code:to Perform Multiply of 2 integers using Bitwise Operator
If u know,Share The Logic Plz....
How to write a program
?Code:to Perform Multiply of 2 integers using Bitwise Operator
If u know,Share The Logic Plz....
Share Other than Repeated Addition Logic
Search the Web for "bitwise multiplication"? Personally, I will not bother since a * b is likely to be no worse than anything you can implement yourself via bitwise operators. On the other hand, if you are talking about specific cases, then things like a bitwise left shift can come in handy... but an optimising compiler may perform such an optimisation for you anyway.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
You'll be embarrassed if I tell you!
Think about base 10 (normal number system). If you multiply times the base, it's the same as adding a zero to the right hand side of the number: 12 * 10 = 120.
That's true with any base numbering system, even binary (base 2).
We can't add a number to the right, exactly, but we can do the same thing by pulling the current digits of the number...