Sum of product of consecutive Binomial Coefficients | PHP Program to find sum of product of consecutive Binomial Coefficient . ; Find the binomial coefficient upto nth term ; $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 . ; finding the sum of product of consecutive coefficient . ; Driver Code
< ? php $ MAX = 100 ; function binomialCoeff ( $ C , $ n ) { for ( $ i = 1 ; $ i <= $ n ; $ i ++ ) { for ( $ j = min ( $ i , $ n ) ; $ j > 0 ; $ j -- ) $ C [ $ j ] = $ C [ $ j ] + $ C [ $ j - 1 ] ; } return $ C ; } function sumOfproduct ( $ n ) { global $ MAX ; $ sum = 0 ; $ C = array_fill ( 0 , $ MAX , 0 ) ; $ C = binomialCoeff ( $ C , $ n ) ; for ( $ i = 0 ; $ i <= $ n ; $ i ++ ) $ sum += $ C [ $ i ] * $ C [ $ i + 1 ] ; return $ sum ; } $ n = 3 ; echo sumOfproduct ( $ n ) ; ? >