Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int N;
- cin>>N;
- int a=1;
- int b=1;
- if(N >= 1)
- cout << 1 << endl;
- if(N >= 2)
- cout << 1 << endl;
- while(b<=N){
- b+=a;
- a=b-a;
- if(b>N){
- break;
- }
- cout<<b<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment