Program to calculate value of nCr | PHP program To calculate the Value Of nCr ; Returns factorial of n ; Driver code
< ? php function nCr ( $ n , $ r ) { return fact ( $ n ) / ( fact ( $ r ) * fact ( $ n - $ r ) ) ; } function fact ( $ n ) { $ res = 1 ; for ( $ i = 2 ; $ i <= $ n ; $ i ++ ) $ res = $ res * $ i ; return $ res ; } $ n = 5 ; $ r = 3 ; echo nCr ( $ n , $ r ) ; ? >