Count of decreasing pairs formed from numbers 1 to N | Function to count the possible number of pairs ; if the number is even then the answer in ( N / 2 ) - 1 ; if the number is odd then the answer in N / 2 ; Driver Code
function divParts ( N ) { if ( N % 2 == 0 ) document . write ( ( N / 2 ) - 1 ) ; else document . write ( ( N / 2 ) ) ; } let N = 8 ; divParts ( N ) ;