Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <iostream>
using namespace std;
int f(int n, int prev = 0, int next = 1) {
if (not n) return prev;
return f(n - 1, next, prev + next);
}
int main(void) {
cout << f(4) << '\n';
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.