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