Tuesday, November 15, 2011

Print fibonacci series upto n: recursion

/* Print fibonacci series upto n: recursion */
#include <stdio.h>

int fib(int n)
{
    if(n <= 1)
        return n;
    else
    {
        return fib(n-1) + fib(n-2);
    }
}

int main()
{
    int n,i;
    printf("Enter the limit: ");
    scanf("%d",&n);
    for(i=0; i
    {
        printf("%d ",fib(i));
    }
    return 0;
}

1 comment:

jahliajaimea said...

Golden Nugget Casino - Mapyro
Find Golden Nugget Casino, Las Vegas, Nevada, 여주 출장샵 United 구리 출장마사지 States, 90 photos and 40 tips. 시흥 출장샵 And now you can have a better 김포 출장샵 idea of where to play and where to play 제천 출장샵