Write a program in python to convert binary to decimal using while loop
-----------------------------------------
number=int(input("Enter Any Binary Number : "))
decimal=0
count=0
while number>0:
digit=number%10
decimal=decimal+digit*(2**count)
number=number//10
count=count+1
print("Decimal Value : ",decimal)
-------------------------------------------
Output:-
Enter Any Binary Number : 110101
Decimal Value : 53
0 Comments