You are viewing a single comment's thread. Return to all comments →
Using C#
if (n == 0) { return 0; } else if (n == 1) { return 1; } else { int a = 0, b = 1; for (int i = 2; i <= n; i++) { int temp = a + b; a = b; b = temp; } return b; }
Seems like cookies are disabled on this browser, please enable them to open this website
Recursion: Fibonacci Numbers
You are viewing a single comment's thread. Return to all comments →
Using C#