You are on page 1of 2

#include <iostream>

using namespace std;

int main()

int n;

cout << "n = ";

cin >> n;

int nr_2, nr_1, nr_0;

nr_0 = 0;

nr_1 = 1;

cout << nr_0 << "\n" << nr_1 << "\n";

for(int i = 3; i <= n; i++)

nr_2 = nr_1 + nr_0;

nr_0 = nr_1;

nr_1 = nr_2;

cout << nr_2 << "\n";

return 0;

}
#include <iostream>

using namespace std;

void fibbo (int x)

long long a = 1;

long long b = 1;

long long urm;

cout<<a<<" "<<b<<" ";

while (x)

urm = a + b;

a=b;

b=urm;

cout<<b<< " ";

x--;

int main ()

fibbo (10);

return 0;

You might also like