Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int tab[30],n=0,wynik=0,i=0;
- cout << "Podaj n: " << endl;
- cin >> n;
- for(i=0; i<=n; i++)
- {
- tab[i]=i;
- if(( i!=0)&&(i!=1))
- {
- wynik=tab[i-1]+tab[i-2];
- }
- else if(tab[i]==0) wynik=0;
- else if (tab[i]==1) wynik=1;
- cout << tab[i] << "element ciagu Fibonacciego to: " << wynik << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement