7 kyu

Sum Even Fibonacci Numbers

664 of 1,142AkyunaAkish

Description:

Sum Even Fibonacci Numbers

  • Write a func named SumEvenFibonacci that takes a parameter of type int and returns a value of type int

  • Generate all of the Fibonacci numbers starting with 1 and 2 and ending on the highest number before exceeding the parameter's value

Each new number in the Fibonacci sequence is generated by adding the previous two numbers - by starting with 1 and 2(the input could be smaller), the first 10 numbers will be:

 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
  • Sum all of the even numbers you generate and return that int

Example:

sumEvenFibonacci(8) // returns 10 by adding the even values 2 and 8
Fundamentals

More By Author:

Check out these other kata created by AkyunaAkish

Stats:

CreatedMay 25, 2017
PublishedMay 25, 2017
Warriors Trained2251
Total Skips117
Total Code Submissions5341
Total Times Completed1142
Go Completions664
Python Completions498
Total Stars25
% of votes with a positive feedback rating80% of 278
Total "Very Satisfied" Votes189
Total "Somewhat Satisfied" Votes69
Total "Not Satisfied" Votes20
Total Rank Assessments7
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • AkyunaAkish Avatar
  • ZED.CWT Avatar
  • josemanuel.rincon Avatar
  • saudiGuy Avatar
Ad