write and execute a mixed program to shift a no given no of times
Answers
Answered by
0
Answer:
We can solve this problem with the shift operator. The idea is based on the fact that every number can be represented in binary form. And multiplication with a number is equivalent to multiplication with powers of 2. Powers of 2 can be obtained using left shift operator.
Check for every set bit in the binary representation of m and for every set bit left shift n, count times where count if place value of the set bit of m and add that value to answer.
Similar questions
Social Sciences,
3 months ago
Physics,
7 months ago
Physics,
7 months ago
Chemistry,
1 year ago
Social Sciences,
1 year ago