Nth catalan number
Submissions: 6310   Accuracy:

27.28%

  Difficulty: Easy   Marks: 2

Given a number N. The task is to find the nth catalan number.
The first few Catalan numbers for n = 0, 1, 2, 3, … are 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, …

Input:
First line of input contains a single integer T which denotes the number of test cases. First line of each test case contains a single integer N.

Output:
For each test case, in a new line print the catalan number at position N.
Note: Positions start from 0 as shown above.

Constraints:
1 <= T <= 100
1 <= N <= 100

Example:
Input:

3
5
4
10

Output:
42
14
16796

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal
Author: harsh.agarwal0


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.