/binary

Primary LanguageRuby

Binary

Write a method to convert numbers from binary to decimal. The input should be a string, and the output an integer.

Decimal is the normal system we use for counting. We start at 0, increment until we reach 9, and then reset back to 0 and add another number to the left.

In binary, we also start at zero, but we only increment until we reach 1. Then we reset back to zero and add another number to the left.

Here are some example of numbers in decimal and binary:

Decimal Binary 0 0 1 1 2 10 3 11 4 100 ... ...

Trinary

Epicodus Lesson Week 3 Day 4