A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
3
Task/Fibonacci-sequence/Erlang/fibonacci-sequence-1.erl
Normal file
3
Task/Fibonacci-sequence/Erlang/fibonacci-sequence-1.erl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fib(0) -> 0;
|
||||
fib(1) -> 1;
|
||||
fib(N) when N > 1 -> fib(N-1) + fib(N-2).
|
||||
3
Task/Fibonacci-sequence/Erlang/fibonacci-sequence-2.erl
Normal file
3
Task/Fibonacci-sequence/Erlang/fibonacci-sequence-2.erl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fib(N) -> fib(N,0,1).
|
||||
fib(0,Res,_) -> Res;
|
||||
fib(N,Res,Next) when N > 0 -> fib(N-1, Next, Res+Next).
|
||||
Loading…
Add table
Add a link
Reference in a new issue