Objective
The same number can be written in any base. To convert it from decimal to base b, divide by the base and keep the remainders, from last to first.
Instructions
- The first line has the number
tof cases. Each case is a line withnandb(between 2 and 16). - Show
nwritten in baseb, using the digits0-9A-F(uppercase letters). Do not usebinorformat.
3
10 2
255 16
0 8
1010
FF
0
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise