public class 二维数组练习 {
public static void main(String[] args) {
//1.定义二维数组
int[][] arr = {
{22, 66, 44},
{77, 33, 88},
{25, 45, 65},
{11, 66, 99}
};
//2.计算每个季度的营业额和年总营业额
int year = 0;
for (int i = 0; i < arr.length; i++) {
int sum = 0;
for (int j = 0; j < arr[i].length; j++) {
sum = sum + arr[i][j];
}
System.out.println("第" + (i + 1) + "个季度的营业额为:" + sum + "万元");
year = year + sum;
}
System.out.println("全年总营业额为:" + year + "万元");
}
}