Is there any sequence of left shift and right shift operators that can divide or multiply a number by a number that is not a multiple of 2 i.e. can we multiply a number by 11 using a sequence of left shift and right shift operators .

Recommended Answers

All 2 Replies

Yes, you can simulate multiplication by non-powers-of-two with shifting and adding. For example, 11 = 8 + 2 + 1, you can build up from that.

thanx alot....that was pretty fast reply

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.