#include <iostream>

#include <iostream>

using namespace std;

int main() {
    int N;
    long long a = 0, b = 1, siguiente;
    
    cout << "Terminos: ";
    cin >> N;
    
    cout << "Serie Fibonacci: ";
    for (int i = 1; i <= N; i++) {
        if (i == 1) {
            cout << a << " ";
            continue;
        }
        if (i == 2) {
            cout << b << " ";
            continue;
        }
        siguiente = a + b;
        a = b;
        b = siguiente;
        cout << siguiente << " ";
    }
    cout << endl;
    
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: