File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 44
44
| Problem - 40 | [ Vowel and Consonant ] ( https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-40.js ) |
45
45
| Problem - 41 | [ Find month name. ] ( https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-41.js ) |
46
46
| Problem - 42 | [ Multiplication table. ] ( https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-42.js ) |
47
+ | Problem - 43 | [ Fibonacci ] ( https://github.com/anasmak04/Problem-solving-with-JavaScript/blob/master/problem-43.js ) |
47
48
48
- <!-- | Problem - 43 | | -->
49
+ <!-- | Problem - 44 | | -->
Original file line number Diff line number Diff line change
1
+ function fibonacci ( n ) {
2
+ const fib = [ 0 , 1 ] ;
3
+ for ( let i = 2 ; i < n ; i ++ ) {
4
+ fib [ i ] = fib [ i - 1 ] + fib [ i - 2 ]
5
+ }
6
+
7
+ return fib
8
+ }
9
+
10
+ console . log ( fibonacci ( 10 ) ) ;
11
+
You can’t perform that action at this time.
0 commit comments