Loading Now

BaseChange

Convert the given decimal number to the given base.

Example:

  • For num=1 and base=2 the output should be BaseChange(num, base)=1 (note that it’s not 00001)

  • For num=10 and base=2 the output should be BaseChange(num, base)=1010

  • For num=12 and base=3 the output should be BaseChange(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

Contact