Count factorial numbers in a given range | Function to count factorial ; Find the first factorial number ' fact ' greater than or equal to 'low ; Count factorial numbers in range [ low , high ] ; Return the count ; Driver code
def countFact ( low , high ) : NEW_LINE ' NEW_LINE INDENT fact = 1 NEW_LINE x = 1 NEW_LINE while ( fact < low ) : NEW_LINE INDENT fact = fact * x NEW_LINE x += 1 NEW_LINE DEDENT res = 0 NEW_LINE while ( fact <= high ) : NEW_LINE INDENT res += 1 NEW_LINE fact = fact * x NEW_LINE x += 1 NEW_LINE DEDENT return res NEW_LINE DEDENT print ( " Count ▁ is ▁ " , countFact ( 2 , 720 ) ) NEW_LINE