N阶乘
2010-10-15 11:13 张瀚文zhw 阅读(213) 评论(0) 编辑 收藏 举报class Program
{
public static int Fac(int n)
{
int Fac = 1;
for (; n > 0; n--)
{
Fac = Fac * n;
}
return Fac;
}
static void Main(string[] args)
{
Console.WriteLine("请输入N的值");
int n = int.Parse(Console.ReadLine());
Console.WriteLine("{0}的阶乘为{1}", n, Fac(n));
Console.ReadLine();
}