0
I need to know how to calculate the output of this program
public class Test { public static void main(String[ ] args) { int [ ] [ ] values = {{3, 4, 5, 1}, {33, 6, 1, 2}}; int v = values [0] [0]; for (int row = 0; row < values.length; row++) { for (int i = 1; i < values [1].length; i++) if(v < values [row] [i]) v = values [row] [i]; System.out.print(v + " ")
2 ответов
+ 6
Try this
public class Test {
public static void main(String[ ] args) {
int [ ] [ ] values = {{3, 4, 5, 1}, {33, 6, 1, 2}};
int v = values [0] [0];
for (int row = 0; row < values.length; row++) {
for (int i = 1; i < values [1].length; i++)
if(v < values [row] [i])
v = values [row] [i];
System.out.print(v + " ");
}
}
}
+ 5
And your answer is 5 6