Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int fib (int n)
- {
- if(n==2 || n==1)
- {
- return 1;
- }
- else
- {
- return fib(n-1)+fib(n-2);
- }
- }
- int main()
- {
- int n,res;
- scanf("%d",&n);
- res = fib(n);
- printf("%d",res);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement