Question bank › Bit Manipulation
Dsa Bit Manipulation Medium

Count Set Bits in Number

Write a program that reads a positive integer and counts the number of set bits (1s) in its binary representation. Print the number of set bits. Example: Input: 13 Output: 3

Key concepts

bit_manipulationcounting

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.