|
---|
|
---|
|
---|
C Program for fibanacci series using recursion.
void main()
{
int a,b,i,c;
clrscr();
printf("Enter the N value");
scanf("%d",&a);
for(i=0;i
{
printf("\n%d",fib(i));
}
getch();
}
int fib(int x)
{
if(x==0)
return(0);
if(x<=1)
{
return(1);
}
else
{
return(fib(x-1)+(fib(x-2)));
}
}
|
---|