I'm trying to get the sum of all the even Fibonacci numbers. I can print the numbers out but I can't get the sum of them. This is in java.
class driver {
public static void main(String [] args) {
int a;
int b = 0;
int c = 1;
for (int i = 0; i < 10; i++) { // Finds fibonacci sequence
a = b;
b = c;
c = a + b;
if ( c % 2 == 0) { // Check if it's even
int sum = 0;
sum = sum + c;
System.out.println(sum);
}
else {
}
}
}
}