RosettaCodeData/Task/Factorial/0815/factorial.0815
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

11 lines
380 B
Text

}:r: Start reader loop.
|~ Read n,
#:end: if n is 0 terminates
>= enqueue it as the initial product, reposition.
}:f: Start factorial loop.
x<:1:x- Decrement n.
{=*> Dequeue product, position n, multiply, update product.
^:f:
{+% Dequeue incidental 0, add to get Y into Z, output fac(n).
<:a:~$ Output a newline.
^:r: