Number of Set Bit in a Decimal Number || Python

In this we are going to see a program on how to find Number of Set Bit in a Decimal Number in Python Programming Language.


decimal_number = 45
count = 0
while (decimal_number):
    count += decimal_number & 1
    decimal_number >>= 1
print(count)

# Coded By Dhiraj Shelke

#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post