Write any program to count the 1s in binary represention of the taken number? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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

5th Aug 2018, 10:22 AM
J Santhosh Kumar
J Santhosh Kumar - avatar
2 Respostas
+ 1
get the number convert it into binary convert it into string measure length count 1s in a loop wow! that was hard...
6th Aug 2018, 6:56 PM
Skipper
Skipper - avatar
+ 1
Here is kod. Š’Š¾Ń‚ ŠŗŠ¾Š“. d = int(input()) x = bin(d) x = x[2:] f = x.count('1') print(f)
10th May 2024, 3:33 PM
Ygrymeau
Ygrymeau - avatar