How can I make fibonacci output larger result? - Unix

This is a discussion on How can I make fibonacci output larger result? - Unix ; I can't the right result of Fibonacci(10) or larger number .Help! #include 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; ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How can I make fibonacci output larger result?

  1. How can I make fibonacci output larger result?

    I can't the right result of Fibonacci(10) or larger number .Help!


    #include

    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);
    }
    }

  2. Re: How can I make fibonacci output larger result?

    Blue sky wrote:
    > I can't the right result of Fibonacci(10) or larger number .Help!
    >

    What's wrong with all the answers you have been given in the other
    groups where you asked this?

    --
    Ian Collins

+ Reply to Thread