Facebook
From Smelly Mockingjay, 7 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 207
  1.  
  2. #include "stdafx.h"
  3. #include "iostream"
  4. #include "string"
  5. #include "cstdlib"
  6. #include "iomanip"
  7. #include "ctime"
  8. #include "windows.h"
  9. #include "conio.h"
  10.  
  11. int fibon(int n);
  12. void sortowanie(int tab[], int b);
  13.  
  14. using namespace std;
  15.  
  16. int main()
  17. {
  18.                         int n;
  19.  
  20.                         cout << "Podaj nr wyrazu ciagu: ";
  21.                         cin >> n;
  22.                         cout << n << " Wyraz ciagu ma wartosc " << fibon(n) << endl;
  23.  
  24.                
  25.        
  26.         system("pause");
  27.         return 0;
  28. }
  29.  
  30.  
  31. int fibon(int n)
  32. {
  33.         if (n < 3)
  34.                 return 1;
  35.  
  36.         return fibon(n - 2) + fibon(n - 1);
  37. }