Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main(){
- int n;
- cin >> n;
- int k=0;
- int l=1;
- for(int i=1; i<n; i++){
- if(i==1)cout <<k << " ";
- if(i==2)cout <<l << " ";
- else{
- cout << k+l << " ";
- l=k+l; k=l-k;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment