Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- #ifdef BYREF
- int fibonacci(const int& n)
- #else
- int fibonacci(int n)
- #endif
- {
- if ((n == 1) || (n == 0))
- return n;
- else
- return fibonacci(n - 1) + fibonacci(n - 2);
- }
- int main()
- {
- for (int i = 0; i < 1000; ++i)
- {
- std::cout << " " << fibonacci(i);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement