Find the last two digits of Factorial of a given Number | Function to print the last two digits of N ! ; For N >= 10 , N ! % 100 will always be 0 ; Calculating N ! % 100 ; Driver code
def lastTwoDigits ( N ) : NEW_LINE INDENT if ( N >= 10 ) : NEW_LINE INDENT print ( "00" , end = " " ) NEW_LINE return NEW_LINE DEDENT fac = 1 NEW_LINE for i in range ( 1 , N + 1 ) : NEW_LINE INDENT fac = ( fac * i ) % 100 NEW_LINE DEDENT print ( fac ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 7 NEW_LINE lastTwoDigits ( N ) NEW_LINE DEDENT