i need to build a program to convert

• Binary-to-Octal, Octal-to-Binary.

• Binary-to-Hexadecimal, Hexadecimal-to-Binary.

• Decimal to Binary and Hexadecimal.

• Binary, Hexadecimal, Octal to decimal.

i have no heads or tail how to do this.. I'm thinking of doing a switch case for the user to choose which conversion to choose.. but i have no idea how to create the formula for the coversion.. for example, to change octal to binary, i may use remainder(%).. but how can i arrange it from down upwards?