Write a program to perform number conversion between binary, octal, and decimal.
The first input number indicates the input format: 2 for binary, 10 for decimal, 8 for octal.
The second input number n indicates how many digits the number has.
The next n numbers are the digits of the input number from left to right.
The last number indicates the output format, same as the first number.
For example, converting 12345 in decimal to octal results in 30071. Note that the output must print one digit per line.
The input format. Ex. 2 for binary, 10 for decibal, 6 for octal.
Digits of the number. Ex. 5
digits of the input number from left to right. Ex. 1
2
3
4
5
The output format. Ex. 8
The converted result.
Must be printed one digit per line.
Ex. 3
0
0
7
1