Find Nth fibonacci number

Saratvaddilli
Posted by Saratvaddilli under C# category on | Points: 40 | Views : 1390
            public int FindNthFibonacciNumber(int n)
{
if (n == 1 || n == 2) return 1;

int nthfibonacciNumber = FindNthFibonacciNumber(n - 1) + FindNthFibonacciNumber(n - 2);
return nthfibonacciNumber;
}

Comments or Responses

Login to post response