HOME

Friday, March 20, 2015

C PROGRAM TO FIND FIBONACCI SERIES USING RECURSIVE FUNCTION

#include<stdio.h>
#include<conio.h>
int fibo(int n, int a,int b);
main()
{
    int n;
    printf("enter the limit number:\n");
    scanf("%d",&n);
    fibo(n,0,1);
}
int fibo(int n, int a,int b)
{
    if(a>n)
    {
        return 0;
    }
    else
        {
            printf("%d\t",a);
        return fibo(n,b,a+b);
        }


    }

No comments:

Post a Comment