Minimum numbers to be appended such that mean of Array is equal to 1 | Function to calculate minimum Number of operations ; Storing sum of array arr [ ] ; Driver Code ; Function Call
function minumumOperation ( N , arr ) { let sum_arr = 0 ; for ( let i = 0 ; i < N ; i ++ ) { sum_arr = sum_arr + arr [ i ] ; } if ( sum_arr >= N ) document . write ( sum_arr - N + " " ) ; else document . write ( 1 + " " ) ; } let N = 4 ; let arr = [ 8 , 4 , 6 , 2 ] ; minumumOperation ( N , arr ) ;