I'm trying to calculate the following problem stuck at the moment, I don't want the answer rather would greatly appreciate if anyone could guide me to some resources which may help. I understand the problem just not sure how to represent it.

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

I'm stuck on the part about the sum of even value terms. The following is my latest attempt which I know is wrong.

Thank you to the mod who advised me to check out project Euler, even though I'm rubbish at solving the problems, it's still great.public class main{ public static void main(String[] args){ for(int i = 0;i<=33;i++){ if(i%2==0){ System.out.print(fibonnaci(i) + " "); } } } static int fibonnaci(int n){ if(n==0){ return 0; }else if(n==1){ return 1; }else{ return fibonnaci(n-1)+ fibonnaci(n-2); } } }

Thank you for taking the time to read the thread.