Saturday, November 5, 2011

Help with fibonacci sequence java?

Your problem is that f2 and f1 are never updated. The way you have it, f3 will always be the same and so will fnew because they both rely on data that isn't updated. Also count is not being updated so it will stay in the loop forever. Typically, this problem is solved with a recursive approach, but it can be done with a while loops as well.

No comments:

Post a Comment