Skip to content

Instantly share code, notes, and snippets.

@tiger1710 tiger1710/Source.cpp
Last active Feb 11, 2019

Embed
What would you like to do?
기존의 피보나치수열의 재귀함수
#include <iostream>
using namespace std;
int f(int n) {
if (n < 0) return 0;
if (n < 2) return n;
return f(n - 1) + f(n - 2);
}
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.