//二维数组的求和
题:公司销售额求和
某公司按照月季和月份统计的数据:
第一季度:22,66,44
第二季度:77,33,88
第三季度:25,45,65
第四季度:11,66,99
class Li{
public static void main(String[] args){
int [][] arr={{22,66,44},{77,33,88},{25,45,65},{11,66,99}};
int sum= 0;
for(int x=0;x<arr.lenth;x++){
for(int y=0;y<arr[x];y++){
sum+=arr[x][y];
}
}
System.out.println(sum);
}
}
代码实现(二维数组求和)
最新推荐文章于 2024-04-28 10:46:57 发布
3204

被折叠的 条评论
为什么被折叠?



