Convert a number from decimal to base from 2 to 20.
To write the algorithm, a table of conversions to a hexadecimal system was used.By analogy, we continue the table for 20 bit numbers:
| Num10 | Num20 |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| 10 | A |
| 11 | B |
| 12 | C |
| 13 | D |
| 14 | E |
| 15 | F |
| 16 | G |
| 17 | H |
| 18 | I |
| 19 | J |
| 20 | 10 |
| input | input | output |
|---|---|---|
| Number to convert | Base of a new number | Number in the new number system |
| 9 | 2 | 1001 |
| 16 | 3 | 121 |
| 27 | 5 | 102 |
| 13 | 8 | 15 |
| 29 | 10 | 29 |
| 35 | 12 | 2B |
| 95 | 16 | 5F |
| 67 | 18 | 3D |
| 79 | 20 | 3J |