You are viewing a single comment's thread. Return to all comments →
static long fibb(long n){ if(n<=1) return 0; long sum=2; long n1=1; long n2=2; long n3=0; while(n3<n){ n3=n1+n2; if(n3>n) break; if(n3%2==0) sum+=n3; n1=n2; n2=n3; } return sum; }
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #2: Even Fibonacci numbers
You are viewing a single comment's thread. Return to all comments →