Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath> ///abs= valoare absoluta
- using namespace std;
- int f1, f2, f, n, i; ///variabile globale
- int a,b;
- ///424
- int main()
- {
- cin>>a>>b>>n;
- f1=a; f2=b;
- if(n==1){ cout<<f1; return 0;}
- cout<<f1<<" "<<f2<<" ";
- f=f1;
- while(abs(f)<=n)
- {
- f=f1+f2;
- f1=f2;
- f2=f;
- if(abs(f)<=n) cout<<f<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment