fork(1) download
  1. while True:
  2. num = int(input())
  3. if num == 0:
  4. break
  5. count = 0
  6. while True:
  7. if num % 2 == 1:
  8. count += 1
  9. num = num // 2
  10. else:
  11. print(count)
  12. break
Success #stdin #stdout 0.02s 9300KB
stdin
1
4
7
17
0
stdout
1
0
3
1