From 0a253af87970fc92f954af1443cf5e9525e96600 Mon Sep 17 00:00:00 2001 From: braxtonhall Date: Sun, 30 Oct 2022 21:37:12 -0700 Subject: Add Joel --- entries/joeljih/script.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 entries/joeljih/script.js (limited to 'entries/joeljih/script.js') diff --git a/entries/joeljih/script.js b/entries/joeljih/script.js new file mode 100644 index 0000000..7153a88 --- /dev/null +++ b/entries/joeljih/script.js @@ -0,0 +1,23 @@ +function fib(n) +{ + let a = 0, b = 1, c, i; + if( n == 0) + return a; + for(i = 2; i <= n; i++) + { + c = a + b; + a = b; + b = c; + } + return b; +} + +// Driver code + +let n = 25; + +document.write(fib(n)); + +// This code is contributed by Mayank Tyagi, From geeksforgeeks.org + + -- cgit v1.2.3-70-g09d2