14.Fibonacci series using recursion

 #include <stdio.h>

int fibo(int x);
//fibonacci series using recursion
int main()
{
    int a;
    printf("Enter the Nth number :");
    scanf("%d", &a);
    printf("\nThe fibonacci value of %d is:%d",a,fibo(a));
    return 0;
}
int fibo(int a)
{
    if(a<=1)
    return a;
    else
    return fibo(a-1)+fibo(a-2);
}

Comments