parent
5724ac4273
commit
9c44e0fb29
@ -0,0 +1,21 @@ |
||||
: fac ( num -- out ) |
||||
dup 1 > if dup 1- recurse * then ; |
||||
|
||||
: 0bye ( num -- ) |
||||
0= if bye then ; |
||||
|
||||
: xdrop ( count -- ) |
||||
0 do drop loop ; |
||||
|
||||
: >single ( c-addr u1 -- u2 ) |
||||
0 0 2swap >number 3 xdrop ; |
||||
|
||||
30 chars buffer: buf |
||||
|
||||
." Number: " |
||||
buf 30 accept dup 0bye |
||||
buf swap >single |
||||
|
||||
." Factorial of " dup . ." is " |
||||
|
||||
fac . cr |
Loading…
Reference in new issue