Write a program that converts hexadecimal numbers to decimal, i.e., from base 16 to base 10.
Input will consist of several lines each with an hexadecimal number h of up to 7 hexadecimal digits. The hexadecimal digits representing quantities from 0 to 15 are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f. Letters are given in lowercase.
For each line of input, output should contain a line with the decimal representation of the corresponding input number.
a 10 c0ffee bad
10 16 12648430 2989
Remember the characters
'9' are different
than the numeric values
You can create a function which converts between both
by using an
try first: bin2dec
try also: dec2hex
try next: base2base
Copyright © 2020-2023 Rudy Matela
All rights reserved