Module: Bit Operations (C++)


Problem

10/13

Function

Problem

There is a function that takes a natural number. The function resets all bits of this number, except for the least significant one, and returns the result in decimal notation.

Implement this function.

For example
Given number 40(10) = 101000(2)
The function turns it into 1000(2) = 8(10)

(c) Kurbatov E., 2017