Books :
Day 47: Python Program to Set Bit of an Integer
-
def count_set_bits(n):
count=0
while n > 0:
count += n & 1
n >>= 1
return count
num=int(input("Enter an integer"))
...
No comments:
Post a Comment