Average of odd numbers till a given odd number | Function to calculate the average of odd numbers ; driver function
function averageOdd ( n ) { if ( n % 2 == 0 ) { document . write ( " " ) ; return - 1 ; } return ( n + 1 ) / 2 ; } let n = 15 ; document . write ( averageOdd ( n ) ) ;