Link for Downloading full program C++
VERSION I
int fib(int n)
{
if(n==1) return 0;
else if(n==2) return 1;
else if(n>2) return fib(n-1)+fib(n-2);
else return -1;
}
loop from 1 to the limit
display fib(i)
fibrec()
{
a=0; b=1;
}
int fib(int n)
{
if(n>0)
{
c = a + b; a = b; b = c;
display c;
No comments:
Post a Comment