14
5
Description
Given a number, print the amount of 1
s it has in binary representation.
Input
A number >= 0
in base 10 that won't exceed the highest number your language is able to handle.
Output
The amount of 1
s in binary representation.
Winning condition
The shortest code wins.
Disallowed
- Bitwise operators. Other operators, like addition and multiplication, are allowed.
- Built-in base conversion functions.
Examples
Input: Ouput:
56432 8
Input: Output:
45781254 11
Input: Output:
0 0
Are functions allowed? I want to make a Java solution, but writing full code is too tedious... :/ – HyperNeutrino – 2016-02-13T02:40:31.957
1
I guess I won't be using Wise for this challenge... :)
– MildlyMilquetoast – 2017-03-31T17:17:27.583