#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;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.