You can do it in the same way multiplication is carried out manually.
There are only a view basic operations you'd need to implement.
- Adding two numbers. For simplicity you may want to start by using Strings as the representation using them in reverse digit order, i.e. the least significant digit is on the leftmost side. That way you you can work your way from the left of the string to the right without having to pad one string. You iterate over the characters in the shorter of both strings adding the numbers and keeping the carry for the next digit.
- Multiplying by ten: prepend a 0 to the string (remember we are having the reverse digit order)
- Multiplying by one: return the string (simples ain't it?)
- Multiply a string with a single digit
- Now you have all the basic parts that will allow you to multiply two arbitrary length strings of digits much the same way you learned to do manual multiplication in school.
- Final step before output: Reverse the string to get the digits into "natural order". :)
Regards,
— Manfred