Вычисление факториала - C# (201573)
Формулировка задачи:
Подскажите как записать эту равенство an=(ln(n!))/n2 .Вместо ! поставьте factorial.
Решение задачи: «Вычисление факториала»
textual
Листинг программы
class Program
{
static void Main(string[] args)
{
double a1 = An(10);
double a2 = An(11);
Console.WriteLine("{0} {1}", a1, a2);
Console.ReadKey();
}
static private double An(int n)
{
return (double)(Math.Log(Factorial(n)))/Math.Pow(n,2);
}
static private int Factorial(int numb)
{
int res = 1;
for (int i = numb; i > 1; i--)
res *= i;
return res;
}
}