Binary number
-It is a number which expressed in the base-2 numeral system,
-Binary numbers are 0 or 1.
Decimal number
- A number which expressed in the base-10 numeral system.
- Decimal number range is 0 to 9
Conversion of Binary to Decimal number
Example -
Binary number is 1010
Its decimal equivalent is 10
Binary number is 100000000000
Its decimal equivalent is 2048
program -
print("Enter Binary number")
n=int(input())
s=0
i=0
while(n>0):
t=n%10
s=s+t*(2**i)
n=int(n/10)
i=i+1
print("Decimal equivalent is - "+str(s))
Enter Binary number
111111111
Decimal equivalent is - 511
Enter Binary number
100000000000
Decimal equivalent is - 2048
-In this program, we take input of the binary number, then for each bit of number we convert the decimal equivalent and add them so we get decimal number of given number.