fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int F(int n)
  5. {
  6. if ((n==0) || (n==1)) {return n;}
  7. else {return F(n-1)+F(n-2);}
  8. }
  9.  
  10. int x;
  11.  
  12. int main() {
  13.  
  14. cin>>x;
  15. cout<<F(x)<<endl;
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 5284KB
stdin
8
stdout
21