#include<stdio.h>
#include<conio.h>
int fib(int);
main()
{
int n,i;
printf("enter the limit: ");
scanf("%d",&n);
printf("fibinacci series is: ");
for(i=1;i<=n;i++)
printf("%d ",fib(i));
}
int fib(int n)
{
if(n==1)
return 0;
else
{
if(n==2)
return 1;
else
return(fib(n-1)+fib(n-2));
}
}
#include<conio.h>
int fib(int);
main()
{
int n,i;
printf("enter the limit: ");
scanf("%d",&n);
printf("fibinacci series is: ");
for(i=1;i<=n;i++)
printf("%d ",fib(i));
}
int fib(int n)
{
if(n==1)
return 0;
else
{
if(n==2)
return 1;
else
return(fib(n-1)+fib(n-2));
}
}
No comments:
Post a Comment
Convey your thoughts to authors.