Advertisement
g-stoyanov

Exercise10Catalan

Dec 4th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3.  
  4. class Exercise10Catalan
  5. {
  6.     static BigInteger Factorial(int factor)
  7.     {
  8.         if (factor > 1)
  9.         {
  10.             return factor * Factorial(--factor);
  11.         }
  12.         return 1;
  13.     }
  14.     static void Main()
  15.     {
  16.         int n = int.Parse(Console.ReadLine());
  17.         Console.WriteLine(Factorial(2*n) / (Factorial(n+1) * Factorial(n)));
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement