You are setting sum to 0 each time the loop iterates. That is not what you should be doing. The sum should be initialized to 0 outside the loop, not within the loop.
Regards,
Paul McKenzie
| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | VB Forums | Developer.com |
|
Results 1 to 7 of 7
Thread: Fibonacci SequenceThreaded View
|
Click Here to Expand Forum to Full Width |