44 lines
1.2 KiB
Java
44 lines
1.2 KiB
Java
/**
|
|
* MinMatrix
|
|
*/
|
|
public class MinMatrix {
|
|
public static void main(String[] args) {
|
|
int[][] morpheous = { { 13, 53, 47 }, { 32, 53, 87 }, { 86, 43, 74 } };
|
|
int temp = morpheous[0][0];
|
|
int matrixMax = 0;
|
|
int z = 0;
|
|
int max = 0;
|
|
String str = "";
|
|
for (int i = 0; i < morpheous.length; i++) {
|
|
System.out.println("");
|
|
for (int k = 0; k < morpheous[i].length; k++) {
|
|
System.out.print(morpheous[i][k]);
|
|
if (morpheous[i][k] > matrixMax) {
|
|
matrixMax = morpheous[i][k];
|
|
}
|
|
System.out.print("\t");
|
|
if (morpheous[i][k] < temp) {
|
|
temp = morpheous[i][k];
|
|
z = k;
|
|
}
|
|
if (morpheous[i][z] > max) {
|
|
max = morpheous[i][z];
|
|
}
|
|
|
|
}
|
|
}
|
|
if (z == 0) {
|
|
str = "first";
|
|
} else if (z == 1) {
|
|
str = "second";
|
|
} else {
|
|
str = "thrid";
|
|
}
|
|
System.out.println("");
|
|
System.out.println("the largest number in the morpheous Matrix is: " + matrixMax);
|
|
System.out.println("The smallest number in the matrix is: " + temp + " in the " + str + " column!");
|
|
System.out.println("The largest number in the same column is: " + max);
|
|
|
|
}
|
|
}
|