All Tracks Basic Programming Bit Manipulation Basics of Bit Manipulation Problem

Count the bits
/

Very-Easy

Problem
Editorial
Analytics

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:

  • \( 1 \le T \le 1000 \)
  • \( 1 \le N \le 1000\)
SAMPLE INPUT
1
4
SAMPLE OUTPUT
1
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

Initializing Code Editor...
Notifications
View All Notifications

?