Posted by: Sourav | August 1, 2014

Fbonacci Series using recursion in C


 

#include<stdio.h>
void fibo(int,int);
void main()
{
int first=0;
int second=1;
//getch();
printf(“\n%d %d”,first,second);
fibo(first,second);

 

}
void fibo(int i,int j)
{
static int counter=1;
  int temp;
 while(counter<=25)
 {
  temp=i;
 i=j;
 j=temp+i;
 printf(” %d”,j);
 //getch();
 counter++;
 fibo(i,j);
 
 }
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: