Skip to content

Commit 93898c7

Browse files
committed
ejercicio12
1 parent d114f79 commit 93898c7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ejercicio12.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function Fibonacci(num) {
2+
if (num === 1) return [1]
3+
if (num === 2) return [1, 1]
4+
let list = [1, 1]
5+
for (let i = 2; i < num; i++) {
6+
list.push(list[i - 1] + list[i - 2])
7+
}
8+
return list
9+
}
10+
11+
console.log(Fibonacci(20))

0 commit comments

Comments
 (0)