Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int x = 0;
- int cnt = 0;
- scanf("%d", &x);
- for (; x; x /= 2)
- cnt += x % 2 ? 1 : 0;
- printf("%d", cnt);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement