Maximum value of | arr [ 0 ] | Function to return the maximum required value ; Driver code
function maxValue ( n ) { if ( n == 1 ) return 0 ; return ( parseInt ( n * n / 2 ) - 1 ) ; } var n = 4 ; document . write ( maxValue ( n ) ) ;