diff --git a/Project Euler/problem-2-even-fibonacci-numbers.json b/Project Euler/problem-2-even-fibonacci-numbers.json new file mode 100644 index 0000000..6573415 --- /dev/null +++ b/Project Euler/problem-2-even-fibonacci-numbers.json @@ -0,0 +1 @@ +{"index.js":"function fiboEvenSum(n) {\n // You can do it!\n const fibArr =[1,2];\n let sumFibEven =0;\n // generate the fibonacci sequence and put it into fibArr\n for(let i =0;i < n - 1;i++){\n let sumFibElem = fibArr[i] + fibArr[i+1];\n fibArr.push(sumFibElem);\n }\n // verify and sum the even numbers in the fibArr\n for(let i =0;i < fibArr.length ;i++){\n if(fibArr[i]%2 === 0){\n sumFibEven+= fibArr[i];\n }\n }\n \n return sumFibEven;\n}\n\nfiboEvenSum(10);"} \ No newline at end of file