Find smallest number K such that K % p = 0 and q % K = 0 | Function to return the minimum value K such that K % p = 0 and q % k = 0 ; If K is possible ; No such K is possible ; Driver code
def getMinVal ( p , q ) : NEW_LINE INDENT if q % p == 0 : NEW_LINE INDENT return p NEW_LINE DEDENT return - 1 NEW_LINE DEDENT p = 24 ; q = 48 NEW_LINE print ( getMinVal ( p , q ) ) NEW_LINE