FIBONACCI SERIES
Code :
#include<stdio.h>
int fibonacci(int n);
int main()
{
int n, term;
printf("\t FIBONACCI SERIES\n");
printf("-------------------------------------\n");
printf("Enter number of mximum terms : ");
scanf("%d", &n);
printf("\nFibonacci series upto %d terms,\n\n", n);
for(int i=0; i<=n; i++)
{
printf("%d ", fibonacci(i));
}
printf("\n\n*************************************\n");
return 0;
}
int fibonacci(int n)
{
if(n == 0)
{
return 0;
}
else if(n == 1)
{
return 1;
}
else
{
return fibonacci(n-1) + fibonacci(n-2);
}
}