Fibonacci series using recursive function

Write a program using recursive to read positive number  and determine the fibonacci series of n terms

C Program source code

#include<stdio.h>
#include<conio.h>
int fibbo(int n1, int n2);
int n ,no=1 ,temp;
int main ()
{   int n1=0,n2=1;
    printf("Enter number of terms in fibbonaccic series:");
    scanf("%d",&n);
    printf("\n");
 printf("fibbonaccic series of %d term are  :\n" , n);
 printf("%d\t",n1);
 printf("%d\t",n2);
 fibbo(n1,n2);
 getch();
 return 0 ;
}
int fibbo(int n1 , int n2)
{
 if(no==n-1)
 return 0;
 temp = n1;
 n1=n2;
 n2 =n1+ temp;
 printf("%d\t",n2);
 no++;
 fibbo(n1,n2);
 
}


You can Browse related article below for more information and program code related to string function

 Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required


Fibonacci series using recursive function

Comments

Popular posts from this blog

Print pattern in c - explore new perspectives in pattern printing

Copy Constructor

C++ Input/Output : Streams