Hey If you are beginner and want to learn a python then you are on right path. Learn basic as well as advanced programming in Python.

Search

Python program to convert the binary number to decimal equivalent.

PYTHON PROGRAM




n=int(input("Enter a Binary number:"))

num=n

d=0

base=1

while(n>0):

rem=n %10

d=d+ rem * base

n=n//10 

base=base * 2

print ("Decimal number of",num,"is:",d)




*** Input && Output ***





No comments:

Post a Comment

let me know which type examples you want to comment me.