summaryrefslogtreecommitdiff
path: root/sysroot/bin/sh/fib
diff options
context:
space:
mode:
Diffstat (limited to 'sysroot/bin/sh/fib')
-rw-r--r--sysroot/bin/sh/fib10
1 files changed, 10 insertions, 0 deletions
diff --git a/sysroot/bin/sh/fib b/sysroot/bin/sh/fib
new file mode 100644
index 0000000..6d84b1b
--- /dev/null
+++ b/sysroot/bin/sh/fib
@@ -0,0 +1,10 @@
+#!/bin/lua
+
+function fib(n)
+ if n <= 1 then return 1 end
+ return fib(n-1) + fib(n-2)
+end
+
+for i=1,13 do
+ print("fib("..i..")\t= " .. fib(i))
+end