#C412. Sum of Even Fibonacci Numbers
Sum of Even Fibonacci Numbers
Sum of Even Fibonacci Numbers
Given an integer \(N\), compute the sum of all even Fibonacci numbers that are less than or equal to \(N\). The Fibonacci sequence is defined as \(F(0)=0, F(1)=1\) and for \(n \ge 2\), \(F(n)=F(n-1)+F(n-2)\). Only the even-valued terms in the sequence are to be summed.
For example, if \(N = 34\), the Fibonacci sequence up to 34 is \(0, 1, 1, 2, 3, 5, 8, 13, 21, 34\), and the even numbers among these are \(2, 8,\) and \(34\), so the answer is \(2+8+34=44\).
inputFormat
The input consists of a single integer \(N\) on standard input, representing the upper bound.
outputFormat
Output a single integer representing the sum of all even Fibonacci numbers less than or equal to \(N\), printed to standard output.
## sample10
10
</p>