Fibonacci.m is been added

This commit is contained in:
programarivm 2019-09-25 20:55:36 +01:00
parent 2e1b478eee
commit 7b07feb800
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -191,6 +191,10 @@ Copy the examples into your `~/.fis-gtm/V6.3-003A_x86_64/r` folder and run:
Enter n: 5
5! = 120
### [`Fibonacci.m`](https://github.com/programarivm/mumps-examples/blob/master/02-user-defined-functions/Fibonacci.m)
Enter n: 9
F(9) = 34
---
### Contributions