def binary_to_decimal(binary):
    """
    Converts a binary number into a decimal number.
    """
    decimal = 0
    index = 0
    while binary > 0:
        last = binary % 10
        binary = binary / 10
        decimal += (last * (2 ** index))
        index += 1
    return decimal