Fibonacci.m is been added
This commit is contained in:
parent
2e1b478eee
commit
7b07feb800
|
@ -0,0 +1,12 @@
|
|||
write "Enter n: "
|
||||
read n,!
|
||||
set result=$$fibonacci(n)
|
||||
write "F(",n,") = ",result,!
|
||||
halt
|
||||
|
||||
fibonacci(n)
|
||||
set f(1)=1
|
||||
set f(2)=1
|
||||
for i=3:1:n do
|
||||
. set f(i)=f(i-1)+f(i-2)
|
||||
quit f(n)
|
Loading…
Reference in New Issue