[Solved] How to take average of number of values greater than some value in array? [closed]

[ad_1]

public static int isGreater(int limit, int[] data){
int overLimit = 0; 
      for(int k = 0; k < data.length; k++){
        if (data[k] > limit) overLimit++;
      }
return (overLimit/data.length)*100;
}

By keeping a running calculation of the numbers that are over and under the limit, you can calculate what percentage of the overall list was greater than the limit.
Hope this helps!

10

[ad_2]

solved How to take average of number of values greater than some value in array? [closed]