Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- short int n, i;
- cout << "Number of Fibonacci Terms: " << flush;
- cin >> n;
- int ara[n];
- ara[0] = 0;
- ara[1] = 1;
- cout << ara[0] << " " << ara[1] << " ";
- for (i = 2; i < n; i++)
- {
- ara[i] = ara[i - 2] + ara[i - 1];
- cout << ara[i] << " ";
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement