using System;
using System.Collections.Generic;
using System.Text;
namespace ExFactorial
{
class Factorial
{
public double factorial(int num)
{
switch (num)
{
case 1:
return 1;
default :
return num * factorial(num - 1);
}
}
static void Main(string[] args)
{
Console.WriteLine("输入一个整数:");
int num=Convert.ToInt32 (Console.ReadLine());
Factorial f = new Factorial();
Console.WriteLine("{0}!的值为{1}", num, f.factorial(num));
}
}
}