package com.hidata.devops.paas.demo;
import java.util.Random;
/**
* 任务2、求二维数组的平均数
*/
public class ArrayAvgTest {
public static void main(String[] args) {
int [] [] arr = new int [5][5];
int total = 0;
Random random = new Random();
for (int i = 0; i < arr.length; i++) {
System.out.println();
for (int j = 0; j < arr.length; j++) {
int num = random.nextInt(20-10+1)+10;
arr[i][j] = num;
System.out.print(arr[i][j] + "\t");
total = total+arr[i][j];
}
}
int avg = total/(arr.length*arr[0].length);
System.out.println("");
System.out.println("整个二维数组的平均值为:" + avg );
}
}