This question already has an answer here:
- Add two numbers 188 answers
You must create a program that does addition using string manipulation, similar to:
999 + 1 ---- 1000
Which means the maximum amount of addition possible is
9+9+9. And your code should handle numbers up to infinity (since the addition is done on strings).
Breakdown of 999+1
addend #1 + addend #2 + carry
9+1+0=10, result=0, carry=1, output=0.
9+0+1=10, result=0, carry=1, output=00.
9+0+1=10, result=0, carry=1, output=000.
0+0+1=1, result=1, carry=0, output=1000. Final output=1000
If your code does this, you did it correctly.
Standard code golf, least amount of characters wins.
Nothing silly, your code must work with all addition problems, and no "In my language "a" does just this!".
Proper loopholes (those that aren't ridiculous) apply.
This is different from "Adding Two Numbers" because...
You must use string manipulation and must add the numbers character by character, there are restrictions past "1+1", you must do "last char of 187+last char of 988".