How can I make fibonacci output larger result?
I can't the right result of Fibonacci(10) or larger number .Help!
#include<stdio.h>
long fibonacci( long n);
int main()
{
long result;
long number;
printf("Enter an integer : ");
scanf("%1d",&number);
result =fibonacci( number );
printf("Fibonacci( %1d ) = %1d\n",number,result);
return 0;
}
long fibonacci( long n )
{
if( n == 0 || n == 1){
return n;
}
else{
return fibonacci( n-1)+fibonacci(n-2);
}
}
Re: How can I make fibonacci output larger result?
Blue sky wrote:[color=blue]
> I can't the right result of Fibonacci(10) or larger number .Help!
>[/color]
What's wrong with all the answers you have been given in the other
groups where you asked this?
--
Ian Collins