How to print the number 1 to 10 recursively in C#

1 Answer

0 votes
using System;

namespace function_recursion_1_to_10
{
	class Class1
	{
		static void Main(string[] args)
		{
			int i = 1;

            recorsive_print_1_to_10(i);

		}
		static void recorsive_print_1_to_10(int i)
		{
			if (i > 10)
				return;
			Console.WriteLine(i);
            recorsive_print_1_to_10(++i);
		}
	}
}



answered Aug 2, 2014 by avibootz
...