递归 阶乘

原文发布时间为:2009-03-01 —— 来源于本人的百度文章 [由搬家工具导入]

using System;
//using System.Collections.Generic;
//using System.Text;

namespace digui1
{
    public class Program
    {
       public static void Main()
        {
            int n;
            n = int.Parse(Console.ReadLine());
            Console.WriteLine("{0}!={1}.", n, fun(n));
            Console.ReadLine();
        }
        public static int fun(int n)
        {
            if (n <= 1)
                return 1;
            else
                return n * fun(n - 1);
        }
    }
}

原文地址:https://www.cnblogs.com/handboy/p/7148502.html