Created
April 26, 2022 18:23
-
-
Save MuddyBootsCode/518e6dd3e521dc052a2414d3fe80bd8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fiboEvenSum(n) { | |
let a = 1; | |
let b = 2; | |
let c = 0; | |
let sum = 0; | |
if (n >=2){ | |
sum += 2; | |
} | |
while(n > c){ | |
c = a + b; | |
a = b; | |
b = c; | |
if (c % 2 === 0){ | |
sum += c; | |
} | |
} | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment