/* Fibonacci series using recursion */
#include<stdio.h>
#include<conio.h>
void main()
{
int fib(int ) ;
int i,r,n;
clrscr();
printf(“Enter How Many terms to be print \n”);
scanf(“%d”,&n);
printf(“Fibonacci series is :\n”);
for(i=1;i<=n;i++)
{
r=fib(i);// Calling with Argument
printf(“%5d”,r);
}
getch();
}
// Function definition
int fib(int x)
{
int f;
if (x==1)
return(0);
else if (x==2)
return(1);
else
f= fib(x-1)+fib(x-2);
return(f);
}
Latest posts by Mohit Arora (see all)
- MongoDB Operators Tutorial – What are Different Operators Available? - October 5, 2019
- MongoDB Projection Tutorial : Return Specific Fields From Query - March 9, 2019
- MongoDB Index Tutorial – Create Index & MongoDB Index Types - July 6, 2018