Hello everyone, I have task "Write a program that calculates N!/K! for given N and K (1<N<K)."
I want to ask is this the right solution ?
using System;
class NandKFactorials
{
public static double fact(double x)
{
double result = 1;
for (int i = 1; i <= x; i++)
result *= i;
return result;
}
public static double calculating(double n, double k)
{
return fact(n) / fact(k);
}
static void Main()
{
Console.WriteLine(calculating(5,6));
}
}