JavaScript program to maximise the sum of two Numbers using at most one swap between them
let MAX = 100 ; function max_element ( arr , pos ) { let tmp = arr [ 0 ] ; let ind = 0 ; for ( let i = 1 ; i < pos ; i ++ ) { if ( tmp < arr [ i ] ) { tmp = arr [ i ] ; ind = i ; } } return ind ; }