Witam problem z wyliczeniem silni, sama metoda(Fe) działa dobrze ale w momencie gdy używam jej w metodzie Snb ,wyświetla błędny wynik , lub jak w tym przypadku jak ustawiłem hardcode na 100 wyrzuca próbę dzielenia przez 0 , choć 0 nie powinno występować.
using System;
namespace marbles_spoj
{
class Program
{
static void Main(string[] args)
{
long a,b;
// a = long.Parse(Console.ReadLine());
// b = long.Parse(Console.ReadLine());
//Console.WriteLine(Factorial(100-100));
Console.WriteLine(Sab(100,100));
}
public static long Sab(long a, long b)
{
return Fa(a) / (Fa(b) * Fa(a - b));
}
public static long Fa(long number)
{
if (number > 1)
{ return number*Fa(number - 1); }
else { return 1; }
}
}
}