Utility function to print the contents of the array
function printArr ( arr , n ) { for ( let i = 0 ; i < n - 1 ; i ++ ) document . write ( arr [ i ] + " " ) ; document . write ( arr [ n - 1 ] . toFixed ( 6 ) ) ; }