Once you have the integer values you can simply add them together to get the total. This holds true for any number.
The key to your question is how to display them in the correct format. You need to use the base number to calculate each digit of the string. This is done by taking the remainder of the number divided by the base repeatedly, until you have used up all the number. You then need to order those numbers correctly before displaying them. Taking your numbers above:
123 + 13 = 136
136 / 4 = 34 remainder 0
34 / 4 = 8 remainder 2
8 / 4 = 2 remainder 0
2 / 4 = 0 remainder 2
So the final display is: 2020 base 4
Oops I misread the question. In order to get the values in a specific base to start with, you need to convert each successive digit. So do not input them directly as
int
types, but read them as a string. Start with a sum variable set to zero. You then take each character and convert it to an
int
. Then multiply the sum by the base and add the integer value to it. Repeat that for each digit in the string. You can then add the two numbers together and display them as described above.