Number of Ones
Given ‘NUM = 9’ Binary representation of ‘9 = 1001’, so there are 2 times 1's present. Print ‘2’ as the answer.
The first line contains a single integer ‘T’ representing the number of test cases. The only line of each test case contains a single integer ‘NUM’ representing an integer whose number of bits which are ‘1’ in the binary representation you need to print.
For each test case print the number of bits ‘1’ in binary representation. Print the output of each test case in a separate line.
You do not need to print anything; it has already been taken care of. Just implement the function.
1 <= T <= 10000 1 <= NUM <= 10^9 Time Limit: 1sec