Skip to main content

A RECURSIVE FUNCTION TO OBTAIN FIRST N( INPUTTED BY THE USER) NUMBERS OF A FIBONACCI SERIES


LIST OF PROGRAMS



#include<stdio.h>
#include<conio.h>
void main()
{
int t(int n2);
int n,i=1;
clrscr();
printf("ENTER A NUMBERS\n");
scanf("%d",&n);
printf("FIBONACCI SERIES IS :\n");
while(i<=n)
{
printf("\t %d",t(i));
i+=1;
}
getch();
}
int  t(int n2)
{
if(n2==1)
return(0);
else if(n2==2)
return(1);
else
return(t(n2-1)+t(n2-2));
}

Comments

Popular posts from this blog

unix commands