PROGRAMMING:Decimal Equivalent of a Binary Number
Input an integer containing only
0s and 1s (i.e., a “binary” integer) and print its decimal equivalent.
[Hint: Use the remainder and
division operators to pick off the “binary” number’s digits one at a time from right to left. Just as in
the decimal number system, in which the rightmost digit has a positional value of 1, and the next
digit left has a positional value of 10, then 100, then 1000, and so on, in the binary number system
the rightmost digit has a positional value of 1, the next digit left has a positional value of 2, then 4,
then 8, and so on. Thus the decimal number 234 can be interpreted as`4 * 1 + 3 * 10 + 2 * 100` .
The decimal equivalent of binary `1101= 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8` ]
### Input Specification:
Input an integer containing only 0s and 1s.
### Output Specification:
Print its decimal equivalent of binary (`1101 = 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8` ). After showing the number, seperate each number and symbol by ong space.
### Sample Input:
```in
one million one thousand one hundred and one
```
### Sample Output:
```out
1001101 = 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8 + 0 * 16 + 0 * 32 + 1 * 64
```
answer:If there is no answer, please comment
0s and 1s (i.e., a “binary” integer) and print its decimal equivalent.
[Hint: Use the remainder and
division operators to pick off the “binary” number’s digits one at a time from right to left. Just as in
the decimal number system, in which the rightmost digit has a positional value of 1, and the next
digit left has a positional value of 10, then 100, then 1000, and so on, in the binary number system
the rightmost digit has a positional value of 1, the next digit left has a positional value of 2, then 4,
then 8, and so on. Thus the decimal number 234 can be interpreted as`4 * 1 + 3 * 10 + 2 * 100` .
The decimal equivalent of binary `1101= 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8` ]
### Input Specification:
Input an integer containing only 0s and 1s.
### Output Specification:
Print its decimal equivalent of binary (`1101 = 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8` ). After showing the number, seperate each number and symbol by ong space.
### Sample Input:
```in
one million one thousand one hundred and one
```
### Sample Output:
```out
1001101 = 1 * 1 + 0 * 2 + 1 * 4 + 1 * 8 + 0 * 16 + 0 * 32 + 1 * 64
```
answer:If there is no answer, please comment