#include<stdio.h>
#include<conio.h>
void FiboScrs(int);
int main()
{
int n;
printf("\nEnter Range of Fibonacci Series: ");
scanf("%d",&n);
printf("\nFibonacci Series: ");
printf("%d %d ",0,1);
FiboScrs(n);
return 0;
}
void FiboScrs(int n)
{
static long int fst=0,scnd=1,sum;
if(n>0){
sum = fst + scnd;
fst = scnd;
scnd = sum;
printf("%ld ",sum);
FiboScrs(n-1);
}
getch();
}
No comments:
Post a Comment