Program:

#include<stdio.h>
int fibo(int n){
    int f;
    if(n == 1 || n == 0) return n;
    f = fibo(n-1) + fibo(n-2);
    return f;
}
int main()
{
    int k,x;
    printf("Enter a number: ");
    scanf("%d",&x);
    k = fibo(x);
    printf("The %d number in fibonacci series is: %d\n",x,k);
    return 0;
}

Output:

Enter a number: 6
The 6 number in fibonacci series is: 8

Leave a Reply

Your email address will not be published. Required fields are marked *