sumEven a sum =
if a % 2 == 0 then
a + sum
sumfibs max a b sum =
if a > max then
sumfibs max b (a + b) (sumEven a sum)
To call, max Fib value = 4000000, start with first 2 Fibs (1 and 2), initial sum = 0.
sumfibs 4000000 1 2 0
Pretty understandable, no?
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.