CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
using namespace std;
int main() {
unsigned long first, second, third, n;
first = 0;
second = 1;
cout<<"How many elements?\n";
cin>>n;
cout<<first<<" "<<second;
for(int i =2 ; i < n ; ++i )
{
third = first + second ;
cout <<" "<< third ;
first = second ;
second = third ;
}
return 0;
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run