Advertisement
WiktorMalisak

Zadanie 26

Mar 30th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4.  
  5. void FIBONACCI(int a)
  6. {
  7.      int b=0, c=1;
  8.      for(int i=1;i<a;i++)
  9.      {
  10.             c=c+b;
  11.             b=c-b;
  12.      }
  13.      cout << c << endl;
  14. }
  15.  
  16. int main()
  17. {
  18.     int a;
  19.  
  20.     cout << "Wpisz argument ciagu fibonacciego (n): ";
  21.     cin >> a;
  22.     cout << "wartosc F dla argumentu " << a << " wynosi: ";
  23.     FIBONACCI(a);
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement