Nearest power of two
Suppose we are given a number n and we want to find the nearest number to n which is power of 2 .
For Example: n = 122 then answer is 64 i.e, 26
So, here is a cpp code which we can use
Output: 64
#bitmask
Suppose we are given a number n and we want to find the nearest number to n which is power of 2 .
For Example: n = 122 then answer is 64 i.e, 26
So, here is a cpp code which we can use
Output: 64
#bitmask
Comments
Post a Comment