summaryrefslogtreecommitdiff
path: root/sysroot/bin/sh/fib
diff options
context:
space:
mode:
authordzwdz2023-02-25 19:18:33 +0100
committerdzwdz2023-02-25 19:18:33 +0100
commit51c39c73692e755596eafb0d6f732581fee3ba98 (patch)
treedfb79d40b193474dc89a474bdaa5b64d6285e5d8 /sysroot/bin/sh/fib
parent1326ab41a907ad95405cc86d932b3fc47c614c1c (diff)
merge the initrd and sysroot directories
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