fibonacci in C# : Method Recursion « Class « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

public class MainClass
{
   public static void Main(){
      Console.WriteLine(Fibonacci(10));
   }
    static int Fibonacci(int x)
    {
        if (x <= 1)
            return 1;
        return Fibonacci(x - 1) + Fibonacci(x - 2);
    }
}
89








7.9.Method Recursion
7.9.1.A simple example of recursion.
7.9.2.Display a string in reverse by using recursion
7.9.3.fibonacci in C#
7.9.4.Recursion Count