Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Catalan numbers in java
The nth Catalan number in terms of binomial coefficients is calculated by the formula
(n + k )/k where k varies from 2 to n and n ≥ 0. i.e.
Cn = (2n)!/((n+1)!n!)
Program
public class CatalanNumbers {
public static long fact(int i) {
if(i Output
Enter a number :
7
C0: 1
C1: 1
C2: 2
C3: 5
C4: 14
C5: 42
C6: 132
C7: 429
Advertisements
