Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int function(int i)
- {
- if (i < 1) return 0;
- if (i == 1) return 1;
- return function(i - 1) + function(i - 2);
- }
- int main()
- {
- int i = 0;
- while (i < 10)
- {
- cout << function(i) << endl;
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement