Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int recursion(int a)
- {
- if(a<=1)
- return a;
- else
- {
- return(recursion(a-1)+recursion(a-2));
- }
- }
- int main()
- {
- int input,n,i,j;
- cin>>input;
- n=recursion(input);
- cout<<n;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment