Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- // wywołanie rekurencyjne - funkcja wywołuje się sama wewnątrz siebie
- unsigned long long fibonacci(unsigned n)
- {
- if(n == 1 || n == 2)
- return 1;
- return fibonacci(n - 1) + fibonacci(n - 2);
- }
- int main()
- {
- cout << fibonacci(10);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment