Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Fibonacci-sequence/Whitespace/fibonacci-sequence-2.ws
Normal file
12
Task/Fibonacci-sequence/Whitespace/fibonacci-sequence-2.ws
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
push 0
|
||||
push 1
|
||||
|
||||
0:
|
||||
swap
|
||||
dup
|
||||
onum
|
||||
push 10
|
||||
ochr
|
||||
copy 1
|
||||
add
|
||||
jump 0
|
||||
|
|
@ -0,0 +1 @@
|
|||
|
||||
29
Task/Fibonacci-sequence/Whitespace/fibonacci-sequence-4.ws
Normal file
29
Task/Fibonacci-sequence/Whitespace/fibonacci-sequence-4.ws
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
; Read n.
|
||||
push 0
|
||||
dup
|
||||
inum
|
||||
load
|
||||
|
||||
; Call fib(n), ouput the result and a newline, then exit.
|
||||
call 0
|
||||
onum
|
||||
push 10
|
||||
ochr
|
||||
exit
|
||||
|
||||
0:
|
||||
dup
|
||||
push 2
|
||||
sub
|
||||
jn 1 ; Return if n < 2.
|
||||
dup
|
||||
push 1
|
||||
sub
|
||||
call 0 ; Call fib(n - 1).
|
||||
swap ; Get n back into place.
|
||||
push 2
|
||||
sub
|
||||
call 0 ; Call fib(n - 2).
|
||||
add ; Leave the sum on the stack.
|
||||
1:
|
||||
ret
|
||||
Loading…
Add table
Add a link
Reference in a new issue