Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int x;
- void fibonacci(int x)
- {
- long long a = 0, b = 1;
- for(int i=0;i<x;i++)
- {
- cout<<b<<" ";
- b = a+b;
- a = b-a;
- }
- }
- int main()
- {
- cout<<"Podaj do którego wyrazu ciągu fibonacciego podać wartość: ";
- cin>>x;
- fibonacci(x);
- return 0;
- }
Add Comment
Please, Sign In to add comment