【发布时间】:2015-08-17 07:26:20
【问题描述】:
public class SmallestColumn2{
public static void main(String[] args){
int [][] smallest = new int [][]{{17,70,97,-20},{27,73},{84,80,40,280},{90,98,58,-48,104}};
System.out.println("Smallest per column");
for(int col = 0; col < 5; col++){
int least = smallest[0][col];
for(int r = 0; r < 4; r++){
if (smallest [r][col] < least){
least = smallest[r][col];
}
}
System.out.println("Column " + col + ":" + least);
}
}
}
【问题讨论】:
-
您的代码是如何工作的以及您的期望是什么?
-
应该显示每列的最小值
标签: java multiple-columns