Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- # Programação 1, 2014.1 Pedro Paulo
- # Octal Decimal
- numeros_str = raw_input()
- tamanho_numero = len(numeros_str)
- potencia = 0
- total_decimal = 0
- for i in range (0, tamanho_numero):
- convertido = int(numeros_str[i]) * (8**((tamanho_numero - i)-1))
- numeral_da_vez = int(numeros_str[i])
- potencia = ((tamanho_numero - i)-1)
- print "%d * 8^%d = %d" % (numeral_da_vez, potencia, convertido)
- total_decimal += convertido
- print "%s(8) = %d(10)" % (numeros_str, total_decimal)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement