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