feat(fibonacci): Implementacao da funcao fibonacci

This commit is contained in:
Wellington Duarte Santos 2022-11-01 09:10:41 -03:00
parent 89b65c171e
commit fe7512aaff

View File

@ -1,4 +1,16 @@
export function fibonacci(value) {
// implementar logica aqui
var a = 0, b = 1;
if(value === 0){
return a;
}
for (var i = 2; i <= value; ++i) {
var temp = a;
a = b;
b += temp;
}
return b;
}