You need to know when you have finished the string of 2 (or is that 3) digits. The challenge is usually solved by either sending an end of input character, like return, or by using a timeout, like tv remotes do for the channel number.

Once you have the end of number defined, the rest is easy. Initialize the number to zero. Then for each digit multiply the number by 10 and add the new number in. So the sequence could be 0, 1, 1x10+2=12, 12x10+3=123, etc.