我有代码:
double myVar = 4000000;
然而java返回一个值说:“令牌上的语法错误“;”,{在这个令牌之后是预期的”
建议?
干杯!
完整代码:
public class FibonacciSum {
double a = 1;
double b = 1;
double sum = 0;
double evenSum = 0;
double target = 4000000;
while(sum < target) {
sum = a + b;
a = b;
b = sum;
if(sum % 2 == 0)
evenSum += sum;
}
System.out.println(evenSum);
}