0
class Main {
public static void main(String[] args) {
int list1[] = {1,2,3,4,5};
int list2[] = {-6,7,8,9,0,3};

//IT IS HERE I CANNOT FIGURE OUT HOW TO CALCULATE THE AVERAGES OF THE ABOVE ARRAYS
// calculate and print array average 
System.out.println("List 1: " + averageArray(list1));
System.out.println("List 2: " + averageArray(list2));

System.out.println("List 2: " + averageArray(new int[]{-1,4}));

System.out.println("Min: " + minValue(list2));
System.out.println("Max: " + maxValue(list2));

int result[] = arrayMerge(list1, list2);

Could you please show me how to calculate the mean average of the above arrays

  • Does this answer your question? [How to compute the sum and average of elements in an array?](https://stackoverflow.com/questions/10359907/how-to-compute-the-sum-and-average-of-elements-in-an-array) – Exceptional NullPointer Feb 16 '21 at 16:50
  • you likely otta add a tag for the language you are working with. it looks like some variant of `c` ... but you really ought to tag your Question with the lingo involved. [*grin*] – Lee_Dailey Feb 16 '21 at 21:57

1 Answers1

0

var i, k; You can do it by using loop.

for(i = 0; i < list1.length; i++){
    average += list1[i];
}

for(k = 0; k < list2.length; k++)
{ 
    average += list2[k];
}

console.log(average /= (i+k));