mirror of
https://github.com/c0de-archive/hacktoberfest-2018.git
synced 2024-12-22 13:22:39 +00:00
16 lines
375 B
C++
16 lines
375 B
C++
|
#include <iostream>
|
||
|
using namespace std;
|
||
|
int main() {
|
||
|
int n1 = 0, n2 = 1, n3, num;
|
||
|
cout << "Enter the number of elements: ";
|
||
|
cin >> num;
|
||
|
cout << n1 << " " << n2 << " ";
|
||
|
for(int i = 2; i < num; ++i){
|
||
|
n3 = n1 + n2;
|
||
|
cout << n3 << " ";
|
||
|
n1 = n2;
|
||
|
n2 = n3;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|