Assuming all the array elements are distinc Replace the maximum element with the coefficient of range of the array
for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == max ) { arr [ i ] = coeffOfRange ; break ; } }