borsha06

fibo_re.cpp

Sep 2nd, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int recursion(int a)
  5. {
  6.     if(a<=1)
  7.         return a;
  8.     else
  9.     {
  10.         return(recursion(a-1)+recursion(a-2));
  11.     }
  12. }
  13. int main()
  14. {
  15.     int input,n,i,j;
  16.     cin>>input;
  17.     n=recursion(input);
  18.     cout<<n;
  19.     return 0;
  20.  
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment