Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- class CatalanNumbers
- {
- static void Main()
- {
- int num = int.Parse(Console.ReadLine());
- BigInteger factTwoN=1, factN=1, factNOne=1;
- int doubleNum = 2*num;
- int numPlusOne = num+1;
- while (num > 0)
- {
- factN *= num;
- num--;
- }
- while (doubleNum > 0)
- {
- factTwoN *= doubleNum;
- doubleNum--;
- }
- while (numPlusOne > 0)
- {
- factNOne *= numPlusOne;
- numPlusOne--;
- }
- Console.WriteLine(factTwoN/(factNOne*factN));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement