Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class CatalanNumbers
- {
- static void Main()
- {
- Console.Write("Enter n (1<n<100) : ");
- decimal n = decimal.Parse(Console.ReadLine());
- decimal cn =1;
- if (n==0)
- {
- Console.WriteLine("1");
- }
- else if (1<n&&n<100)
- {
- for (int k = 2; k <= n; k++)
- {
- cn*=(n/k+1);
- }
- Console.WriteLine("Cn = {0:F0}", cn);
- }
- else
- {
- Console.WriteLine("Invalid input!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement