Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int FIBONACCI(int n)
- {
- if(n==0)
- {
- return 0;
- }
- if(n==1)
- {
- return 1;
- }
- return FIBONACCI(n-1)+FIBONACCI(n-2);
- }
- int main()
- {
- cout << FIBONACCI(13) << endl;
- cout << FIBONACCI(7) << endl;
- cout << FIBONACCI(20) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement