C
C#5d ago
St3v3

sum of the even numbers in the fibonacci sequence

Hello, im trying to make a code that calculate the sum of the even numbers of the fib sequence up to the 10th number (for now). The problem i have at the moment is figuring out how to make it calculate the sum, im assuming the problem in in line 21 where i wrote the supposed command for the sum of the even number. Any help would be appreciated.
No description
9 Replies
mtreit
mtreit5d ago
Do the math by hand
Keswiik
Keswiik5d ago
I'm not sure why you're trying to make a nested loop in this. Assuming s is your sum, check if the current fibonacci number is even and add it to your sum if it is.
Mayor McCheese
dotnet add package IsEven --version 5.0.0
Mayor McCheese
IsEven 5.0.0
A robust, extensible, and blue-sky-thinking .NET library for calculating if a number is even.
Mayor McCheese
don't actually use this
mtreit
mtreit5d ago
:Troll:
Core
Core4d ago
This should be illegal
Mayor McCheese
It is in 3 states
St3v3
St3v3OP4d ago
thank u for this suggestion it finally worked!!, i didnt come up with that idea because this is the first time im tryng coding and im lowkey just really lost, but thanks alot for the suggestion i can finally hand in my homework ecstatic

Did you find this page helpful?