codeChallenge/MinMatrix.java
dadgam3er 922420d5e2
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 12s
Gitea Actions Demo / GoBuild (push) Failing after 10s
anoterCode
2024-09-11 23:19:05 -04:00

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);
}
}