summaryrefslogtreecommitdiff
path: root/example/libfib/fib.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/libfib/fib.c')
-rw-r--r--example/libfib/fib.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/example/libfib/fib.c b/example/libfib/fib.c
new file mode 100644
index 0000000..707215d
--- /dev/null
+++ b/example/libfib/fib.c
@@ -0,0 +1,11 @@
+#include "fib.h"
+
+uint64_t fib(const uint64_t n) {
+ if (n <= 0) {
+ return 0;
+ } else if (n == 1) {
+ return 1;
+ }
+ return (fib(n - 1) + fib(n - 2));
+}
+