diff --git a/src/factorial.js b/src/factorial.js index 4f3ae70..e64cb61 100644 --- a/src/factorial.js +++ b/src/factorial.js @@ -1,5 +1,9 @@ const factorial = (number) => { - // your code here + var valor = 1; + for( var i=number;i>0;i--) { + valor *= i; + } + return valor; } -module.exports = factorial; \ No newline at end of file +module.exports = factorial; diff --git a/src/fibonacci.js b/src/fibonacci.js index ea3270f..b759d91 100644 --- a/src/fibonacci.js +++ b/src/fibonacci.js @@ -1,5 +1,17 @@ const fibonacci = (n) => { - // your code here + var lista = new Array; + var anterior = 0; + var siguiente = 1; + var numero = 0; + lista.push(1) +// for( ;lista.length { - // your code here + var valor = true; + if (number == 1 || !Number.isInteger(number) ) + valor = false; + else { + var valor = (number>1); + for( var i=2;i