namespace 递归求n的阶乘 { class Program { static void Main(string[] args) { Console.WriteLine(factory(4)); } static int factory(int n) { if (n == 0 || n == 1) { return 1; } else { return n*factory(n - 1); } } } }
namespace 递归求n的阶乘 { class Program { static void Main(string[] args) { Console.WriteLine(factory(4)); } static int factory(int n) { if (n == 0 || n == 1) { return 1; } else { return n*factory(n - 1); } } } }