You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Technically yes, but this is only a problem if the bound is a Fibonacci number itself. In your example, 8 was a Fibonacci number so it got excluded from the sum, but 4,000,000 isn't so the answer will still be right.
Shouldn't line 4 should read
while(f[0] <= 4e6)
?Your code yields the right answer for an input of 4 million, but consider the fibonacci numbers not exceeding 8.
Even fibonaccis would be 2 and 8, resulting in a sum of 10. Your code would log 2 as the answer.
The text was updated successfully, but these errors were encountered: