Advertisement
pan7nikt

fibonacci_Rekurencyjny

Feb 25th, 2020
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. unsigned input;
  5.  
  6. unsigned long long fb(unsigned n)
  7. {
  8.     if(n==0){cout << "return 0" << endl; return 0;}
  9.     if(n==1){cout << "return 1" << endl; return 1;}
  10.     return fb(n-1) + fb(n-2);
  11. }
  12.  
  13. int main()
  14. {
  15.     cout << "jakiej liczby silnie chcesz wyswietlic?: ";
  16.     cin >> input;
  17.     cout << fb(input) << endl;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement