codeChallenge/MinMatrix.java
2024-09-09 16:10:19 -04:00

25 lines
671 B
Java

/**
* MinMatrix
*/
public class MinMatrix {
public static void main(String[] args) {
int[][] M = { { 31, 53, 65 }, { 23, 86, 99 }, { 5, 45, 66 } };
int temp = M[0][0];
System.out.println("This is the matrix memory allocation");
System.out.println(M);
System.out.println("");
for (int i = 0; i < M.length; i++) {
System.out.println("");
for (int j = 0; j < M[i].length; j++) {
System.out.print(M[i][j]);
System.out.print("\t");
if (M[i][j] < temp) {
temp = M[i][j];
}
}
}
System.out.println("");
System.out.println("The smallest number in this Matrix is: " + temp);
}
}