Number of ways in which N can be represented as the sum of two positive integers | Function to return the number of distinct ways to represent n as the sum of two integers ; Driver code
function ways ( n ) { return parseInt ( n / 2 ) ; } var n = 2 ; document . write ( ways ( n ) ) ;