Sum of product of consecutive Binomial Coefficients | Javascript Program to find sum of product of consecutive Binomial Coefficient . ; Find the binomial coefficient up to nth term ; memset ( C , 0 , sizeof ( C ) ) ; C [ 0 ] = 1 ; nC0 is 1 ; Compute next row of pascal triangle using the previous row ; Return the sum of the product of consecutive binomial coefficient . ; Driver Code
let MAX = 100 ; function binomialCoeff ( n , k ) { let C = new Array ( k + 1 ) ; C . fill ( 0 ) ; for ( let i = 1 ; i <= n ; i ++ ) { for ( let j = Math . min ( i , k ) ; j > 0 ; j -- ) C [ j ] = C [ j ] + C [ j - 1 ] ; } return C [ k ] ; } function sumOfproduct ( n ) { return binomialCoeff ( 2 * n , n - 1 ) ; } let n = 3 ; document . write ( sumOfproduct ( n ) ) ;