Hello, I need help to write a progam which converts any base number to any other base.

For example: if the input base is 2 and the value is 10000110, then the value in base 10 136, and if the input base is 16 and the value is FF, then the value in base 2 is 11111111.

Thank you, as all help will be appreciated.