Find a pair with sum N having minimum absolute difference | Function to find the value of X and Y having minimum value of abs ( X - Y ) ; If N is an odd number ; If N is an even number ; Driver Code
function findXandYwithminABSX_Y ( N ) { if ( N % 2 == 1 ) { document . write ( ( N / 2 ) + " " + ( N / 2 + 1 ) ) ; } else { document . write ( ( N / 2 - 1 ) + " " + ( N / 2 + 1 ) ) ; } } let N = 12 ; findXandYwithminABSX_Y ( N ) ;