evenFibonnacci sums of all of the even Fibonacci number starting at given postion to its limits, saving in the total

evenFibonacci(position, limit, total)

Arguments

position

The current position

limit

The wanted position

total

The accumulated value

Value

The calculated result

Complexity

This function has the following complexity O($n^2$)

Examples

evenFibonacci(0, 10, 10)
#> [1] 20
evenFibonacci(5, 50, 50)
#> [1] 92
evenFibonacci(50, 1000, 870)
#> [1] 870