Find two numbers with given sum and maximum possible LCM | Function that print two numbers with the sum X and maximum possible LCM ; If X is odd ; If X is even ; If floor ( X / 2 ) is even ; If floor ( X / 2 ) is odd ; Print the result ; Driver Code ; Given Number ; Function call
def maxLCMWithGivenSum ( X ) : NEW_LINE INDENT if X % 2 != 0 : NEW_LINE INDENT A = X / 2 NEW_LINE B = X / 2 + 1 NEW_LINE DEDENT else : NEW_LINE INDENT if ( X / 2 ) % 2 == 0 : NEW_LINE INDENT A = X / 2 - 1 NEW_LINE B = X / 2 + 1 NEW_LINE DEDENT else : NEW_LINE INDENT A = X / 2 - 2 NEW_LINE B = X / 2 + 2 NEW_LINE DEDENT DEDENT print ( int ( A ) , int ( B ) , end = " ▁ " ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT X = 30 NEW_LINE maxLCMWithGivenSum ( X ) NEW_LINE DEDENT