On Wed, Apr 16, 2008 at 8:23 AM, Suja <[EMAIL PROTECTED]> wrote:

>   Pls help me in solving the code snippet below.
>   It would be helpful if you could provide explanation on deriving the answer?
>
>   Find the output for this function. Let the value of m = 10;
>
>  int f1( int m)
>  {
>  if( m <= 0 )
>  {
>  return 1;
>  }
>  else
>  {
>  return ( (f1(m-1)) + (f1(m-2)) );
>  }
>  }
>
>  How many times this loop will run?
>
>  a) 34
>  b) 55
>  c) 89
>  d) Infinite loop

The neat thing about programming is that is doesn't need to involve
guess work. Put the code into a small program, compile and run it.
Then you will have your answer.

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
 If I were to divulge it, it would overturn the world."
 -- Jelaleddin Rumi

Reply via email to