Minimum numbers to be appended such that mean of Array is equal to 1 | C # program for above approach ; Function to calculate minimum Number of operations ; Storing sum of array arr [ ] ; Driver Code ; Function Call
using System ; class GFG { static void minumumOperation ( int N , int [ ] arr ) { int sum_arr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum_arr = sum_arr + arr [ i ] ; } if ( sum_arr >= N ) Console . Write ( sum_arr - N ) ; else Console . Write ( 1 ) ; } static public void Main ( ) { int N = 4 ; int [ ] arr = { 8 , 4 , 6 , 2 } ; minumumOperation ( N , arr ) ; } }