Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- namespace _08._CatalanNumbers
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- BigInteger result = 1;
- BigInteger numerator = 1;
- BigInteger divider = 1;
- if (n < 0 || n > 100)
- {
- Console.WriteLine("Invalid number!");
- }
- else
- {
- for (int k = 2; k <= n; k++)
- {
- numerator *= n + k;
- divider *= k;
- }
- result = numerator / divider;
- Console.WriteLine(result);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement