阶乘系数公式如下:
(n,k)=n!/(k!*(n-k)!) 0<=k<=n
我输入参数(100,10)报错,好像是除数为0;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace rocktest
{
    class Program
    { public static double factor(int n, int x) 
        {
            long N = 1;
            long I = 1;
            long N_I = 1;
            double tmp;
            for (int i = 1; i <= n; i++)
            {
                N *= i;
            }
            for (int j = 1; j <= x; j++)
            {
                I *= j;
            }
            for (int k = 1; k <= (n - x); k++)
            {
                N_I *= k;
            }
            tmp = N / (I * N_I);
            return tmp;
        }
static void Main(string[] args)
{
  System.Console.WriteLine(Program.factor(100,10));
 }
}
}