Convert 17 into an equivalent number with base 2.
Answers
Answered by
1
Answer:;
Given a number and its base, convert it to decimal. The base of number can be anything such that all digits can be represented using 0 to 9 and A to Z. The value of A is 10, the value of B is 11 and so on. Write a function to convert the number to decimal.
Example:
Input number is given as string and output is an integer. Input: str = "1100", base = 2 Output: 12 Input: str = "11A", base = 16 Output: 282 Input: str = "123", base = 8 Output: 83
Similar questions