Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder:
To add 17282
and 1342
, you proceed as follows:
place the larger (value wise, not number of digits) number above the smaller number and match up the digits
17282 1342
draw the plus sign (+) to the left of the equation on the second row. The plus sign must be flush with the left side.
17282 + 1342
draw a line of dashes (-) with one dash in each column of the digits of the first line
17282 + 1342 -----
evaluate the expression and write the digits above each column if you need to 'carry' them
1 17282 + 1342 ----- 18624
Your output is what you get after applying step #4. You may have trailing whitespace, but there may not be any leading zeroes.
You must write a program or a function that prints or returns the output.
The input can be taken as either two separate inputs or an array with two items; the type of the inputs can be either string or integer.
This is code golf so shortest code in bytes wins!
Edit:
The largest number you could expect to receive as output/the sum is the largest integer that your system will display without exponents (thanks to Adám).
More examples:
Input:
1596, 8404
Output:
1111
8404
+1596
----
10000
Input:
1776, 76
Output:
11
1776
+ 76
----
1852
Input:
123, 456
Output:
456
+123
---
579