Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int FIBONACCI(int n);
- int main()
- {
- int n;
- cout << "Podaj numer wyrazu ciagu Fibonacciego (Fn):" << endl;
- cin >> n;
- cout <<"Wyraz ten wynosi: "<<FIBONACCI(n) << endl;
- return 0;
- }
- int FIBONACCI(int n)
- {
- if(n==0) return 0;
- if(n==1) return 1;
- return FIBONACCI(n-1)+FIBONACCI(n-2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement