Skip to content

Instantly share code, notes, and snippets.

@nasko90
Created October 30, 2016 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasko90/b8a2f3ce08d24190fb4f57ec1d541141 to your computer and use it in GitHub Desktop.
Save nasko90/b8a2f3ce08d24190fb4f57ec1d541141 to your computer and use it in GitHub Desktop.
using System;
using System.Numerics;
class PrintMyName
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
BigInteger factoriel2N =1;
BigInteger factorielN = 1;
BigInteger factoriel = 1;
BigInteger catalanNum;
for (int i = 1; i <= n * 2; i++)
{
factoriel2N *= i;
if (i <= n )
{
factorielN *= i;
}
if (i <= n +1)
{
factoriel *= i;
}
}
catalanNum = factoriel2N / (factorielN * factoriel);
Console.WriteLine(catalanNum);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment