asmodeus94

fibR

Jan 22nd, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. using namespace std;
  4. int x;
  5. int fibR(int x){
  6.     if ((x==1)||(x==2)) return 1; else return fibR(x-1)+fibR(x-2);
  7. }
  8. int main(){
  9. cin>>x;
  10. cout<<fibR(x);
  11. getchar();getchar();
  12. }
Advertisement
Add Comment
Please, Sign In to add comment