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