Minimum and Maximum number of pairs in m teams of n people | javascript program to find minimum and maximum no . of pairs ; Driver code
function MinimumMaximumPairs ( n , m ) { var max_pairs = parseInt ( ( ( n - m + 1 ) * ( n - m ) ) / 2 ) ; var min_pairs = m * parseInt ( ( ( ( n - m ) / m + 1 ) * ( ( n - m ) / m ) ) / 2 ) + parseInt ( Math . ceil ( ( ( n - m ) / ( m ) ) ) ) * ( ( n - m ) % m ) ; document . write ( " " + min_pairs + " " ) ; document . write ( " " + max_pairs ) ; } var n = 5 , m = 2 ; MinimumMaximumPairs ( n , m ) ;