Python program to convert decimal to binary


Python program to convert decimal to binary using while loop

---------------------------------------------------------

number=int(input("Enter Any Number : "))
binary=""
while number>0:
    digit=number%2
    binary=str(digit)+binary
    number=number//2
print("Binary Value of given decimal number is : ",binary)

---------------------------------------------------------

Output:-

Enter Any Number : 65

Binary Value of given decimal number is :  1000001


Post a Comment

0 Comments