//this code is designed by codenation.
//program to print fibonacci series using recursion.
//5:42 7/2/2021
#include<stdio.h>
int fibonacci(int num);
int main()
{
int element;
int i;
printf("enter the total numbers in fibonacci series :\n");
scanf("%d",&element);
for(i=0;i<element;i++)
{
printf("%d\t",fibonacci(i));
}
return 0;
}
int fibonacci(int num)
{
if(num==0 || num==1)
{
return num;
}
else
{
return fibonacci(num-1)+fibonacci(num-2);
}
return 0;
}
//this code is developed by codenation.
Comments
Post a Comment