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