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