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