index
| submit
| rank
| book

## dec2hex – Decimal do hexadecimal

Write a program that converts decimal numbers to hexadecimal,
i.e., from base 10 to base 16.

Input will consist of several lines each
with a decimal number *d*
of up to 9 decimal digits.

For each line of input,
output should contain a line
with the hexadecimal representation of the corresponding input number.
The hexadecimal digits representing quantities from 0 to 15 should be:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f.
Letters should be given in lowercase.

#### Example Input

```
10
16
12648430
2989
```

#### Example Output

```
a
10
c0ffee
bad
```

### Scoring

- 1/6: works for the above example but produces output in an incorrect format
- 2/6: works for the above example and produces output in the correct format
- 5/6: works for other test cases
- 6/6: works for edge cases

### Hints

Remember the characters `'0'`

through `'9'`

are different
than the numeric values `0`

through `9`

.
You can create a function which converts between both
by using an `if`

or `case`

expression.

try first: dec2bin

try also: hex2dec

try next: base2base

index
| submit
| rank
| book

Copyright © 2020-2021 Rudy Matela

All rights reserved