Recursion Count : Method Recursion « Class « C# / CSharp Tutorial






using System;

class MainClass
{
   public static void Count(int InVal)
   {
      if (InVal == 0)
         return;
      Count(InVal - 1);

      Console.WriteLine("{0} ", InVal);
   }

   public static void Main()
   {
      Count(3);
   }
}
1
2
3








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