Task 3 : Number system conversion
Problem
This task is designed for fun :)
There are so many number systems. We encounter some unusual number systems in our daily lives, namely, decimal (base 10), duodecimal (base 12), and trinary (base 3).
Write a Number System Converter that converts a number from one system to another. You have to handle 3 systems: decimal, duodecimal, and trinary. The converter should be able to convert from/to any of the three systems.
Assumption
There are no spaces between the digits of the input string.
The input string is a non-negative integer. Or else it throws an error message.
The input and output values are in range:
The inputted number system must be an integer.
Example
This is an example that converts 123123123 from decimal to trinary:
This is an example that converts 5201314 from decimal to duodecimal (base 12)
You can verify the answer as below:
(A = 10, B = 11)
Example - Error
However, if the user entered a wrong number system, an error message should be printed:
Please enter a set of number:
Last updated