#include <stdio.h>
// Function to find n'th Fibonacci number
int fib(int n)
{
if (n <= 1)
return n;
return fib(n - 1) + fib(n - 2);
}
int main()
{
int n;
printf("Enter number\n");
scanf("%d",&n);
printf("%dth-Fibonacci number is %d", n, fib(n));
return 0;
}
Comments
Leave a comment