index
| submit
| rank
| book

## bin2dec – Binary to decimal

Write a program that converts binary numbers
to decimal.

Input will consist of several lines each
with a binary number *b*
of up to 30 bits (binary digits).

For each line of input,
output should contain a line
with the decimal representation
of the corresponding input number.

#### Example Input

```
1
10
11
10010
1000
```

#### Example Output

```
1
2
3
18
8
```

### Scoring

Submit your solution to be graded according to the following list:

- 1/6: works for the above example but produces output in an incorrect format
- 2/6: works for the above example and produces output in the correct format
- 5/6: works for other test cases
- 6/6: works for edge cases

### Hints

Remember the characters `'0'`

and `'1'`

are different
than the numeric values `0`

and `1`

.
You can create a function which converts between both
by using an `if`

or `case`

expression.

try first: digit-palindrome

try also: dec2bin

try next: hex2dec

index
| submit
| rank
| book

Copyright © 2020-2023 Rudy Matela

All rights reserved