Advertisement
PiotrJurek

Zad26

Mar 30th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int FIBONACCI(int n)
  6. {
  7. if(n==0)
  8. {
  9. return 0;
  10. }
  11. if(n==1)
  12. {
  13. return 1;
  14. }
  15. return FIBONACCI(n-1)+FIBONACCI(n-2);
  16. }
  17.  
  18. int main()
  19. {
  20. cout << FIBONACCI(13) << endl;
  21. cout << FIBONACCI(7) << endl;
  22. cout << FIBONACCI(20) << endl;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement