Count the bits

2.8

6 votes
Very-Easy
Problem

Given a number N, print the number of set bits in the binary representation of this number.

Input:
The first contains a single integer T denoting the number of test cases. Each test case contains a single integer N

Output:
For each test case, print a single integer denoting the number of set bits in the binary representation of the given N .

Constraints:

  • 1T1000
  • 1N1000
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?