fork download
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4.  
  5. int fib(int n)
  6. {
  7. if(n<3)
  8. return 1;
  9.  
  10. return fib(n-2)+fib(n-1);
  11. }
  12.  
  13. int main()
  14. {
  15.  
  16. int n;
  17. cin>>n;
  18. cout<<fib(n)<<endl;
  19.  
  20. system("pause");
  21. return 0;
  22. }
  23.  
Success #stdin #stdout #stderr 0s 3144KB
stdin
Standard input is empty
stdout
1
stderr
sh: 1: pause: not found