josiftepe

Untitled

Nov 22nd, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int N;
  8.  
  9.     cin>>N;
  10.     int a=1;
  11.     int b=1;
  12.     if(N >= 1)
  13.         cout << 1 << endl;
  14.     if(N >= 2)
  15.         cout << 1 << endl;
  16.     while(b<=N){
  17.      b+=a;
  18.      a=b-a;
  19.      if(b>N){
  20.         break;
  21.      }
  22.      cout<<b<<endl;
  23.     }
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment