Write a function that counts the number of 1s in the binary notation of the given number?
Login to Submit
Input: 12 Output: 2 Reason: 12 in binary is 1100. So there are two ones. Input: 7 Output: 3 Reason: 3 in binary is 111. So there are three ones.