
BaseChange
Convert the given decimal number to the given base.
Example:
-
For
num=1
andbase=2
the output should beBaseChange(num, base)=1
(note that it’s not00001
) -
For
num=10
andbase=2
the output should beBaseChange(num, base)=1010
-
For
num=12
andbase=3
the output should beBaseChange(num, base)=110
Input/Output:
-
[execution time limit] 0.5 seconds
-
The number to convert,
0 ≤ num ≤ 2000
. -
[input] integer base
The base to convert to,
2 ≤ base ≤ 9
. -
[output] integer
Converted number.
Post Comment