Program to calculate value of nCr | Python 3 program To calculate The Value Of nCr ; Returns factorial of n ; Driver code
def nCr ( n , r ) : NEW_LINE INDENT return ( fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ) NEW_LINE DEDENT def fact ( n ) : NEW_LINE INDENT res = 1 NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT res = res * i NEW_LINE DEDENT return res NEW_LINE DEDENT n = 5 NEW_LINE r = 3 NEW_LINE print ( int ( nCr ( n , r ) ) ) NEW_LINE