#include <iostream>
using namespace std;
void printFibonacciSequence(int n) {
int a = 0, b = 1;
cout << "Ciąg Fibonacciego do " << n << "-tego elementu: ";
for (int i = 0; i < n; i++) {
cout << a << " ";
int next = a + b;
a = b;
b = next;
}
cout << endl;
}
int main() {
int n;
cout << "Podaj liczbę elementów ciągu Fibonacciego, które chcesz zobaczyć: ";
cin >> n;
printFibonacciSequence(n);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: