Output the Partial Products
Pyth, 12 bytes
.e**Qsb^Tk_w
Test suite
Takes input newline separated, e.g.
361
674
Explanation:
.e**Qsb^Tk_w
Implicit: Q = eval(input()),T = 10
w Input the second number as a string.
_ Reverse it.
.e Enumerated map, where b is the character and k is the index.
sb Convert the character to an int.
*Q Multiply by Q.
* ^Tk Multiply by T ^ k. (10 ^ index)
JavaScript (ES7), 48 bytes
(a,b)=>[...b+""].reverse().map((d,i)=>10**i*a*d)
ES6 (56 bytes)
(a,b)=>[...b+""].reverse().map((d,i)=>a*d+"0".repeat(i))
Explanation
Returns an array of partial products as numbers.
(a,b)=>
[...b+""] // convert the multiplier to an array of digits
.reverse() // reverse the digits of the multiplier so the output is in the right order
.map((d,i)=> // for each digit d of the multiplier
10**i // get the power of ten of the digit
*a*d // raise the product of the digit to it
)
Test
Test uses Math.pow
instead of **
to make it work in standard browsers.
var solution = (a,b)=>[...b+""].reverse().map((d,i)=>Math.pow(10,i)*a*d)
A = <input type="text" id="A" value="361" /><br />
B = <input type="text" id="B" value="674" /><br />
<button onclick="result.textContent=solution(+A.value,+B.value)">Go</button>
<pre id="result"></pre>
Jelly, 10 bytes
DU×µLR’⁵*×
Try it online!
How it works
DU×µLR’⁵*× Left argument: multiplier -- Right argument: multiplicant
D Convert the multiplier to base 10 (array of digits).
U Reverse the array.
× Multiply each digit by the multiplicant.
µ Begin a new, monadic chain. Argument: A(array of products)
L Get the length of A.
R Turn length l into [1, ..., l].
’ Decrement to yield [0, ..., l-1].
⁵* Compute 10**i for each i in that range.
× Hook; multiply the powers of ten by the corresponding elements of A.