Minimum time required to complete a work by N persons together | Function to calculate the time ; Driver Code
function calTime ( arr , n ) { var work = 0 ; for ( i = 0 ; i < n ; i ++ ) work += 1 / arr [ i ] ; return 1 / work ; } var arr = [ 6.0 , 3.0 , 4.0 ] ; var n = arr . length ; document . write ( calTime ( arr , n ) . toFixed ( 5 ) + " " ) ;