+ 1
Write any program to count the 1s in binary represention of the taken number?
binary representation of number https://code.sololearn.com/c53Y8rY4nDgn/?ref=app
2 Respuestas
+ 1
get the number
convert it into binary
convert it into string
measure length
count 1s in a loop
wow!
that was hard...
+ 1
Here is kod.
Вот код.
d = int(input())
x = bin(d)
x = x[2:]
f = x.count('1')
print(f)