Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int fibonaci(int broj)
- {
- if (broj <= 1)
- return 1;
- else
- return fibonaci(broj - 1) + fibonaci(broj - 2);
- }
- void main()
- {
- int broj;
- cout << "Unesite broj clanova niza: ";
- cin >> broj;
- cout << "Fibonacijev niz je: " << fibonaci(broj) << endl;
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment