Course of Raku / Advanced / More about built-in types / Integers / Exercises

Hex to decimal

Problem

Reading a base and writing it back are inverse operations. Take the hexadecimal number 1A, store its decimal value in a variable, and print two lines: first the decimal value, then that same value converted back into a hexadecimal string.

Example

The program prints:

26
1A

Solution

See the solution

Course navigation

Solution: How many digits   |   Solution: Hex to decimal