Question:
You are given a 3x3 matrix with numbers:
int[][] matrix = {
{8, 1, 6},
{3, 5, 7},
{4, 9, 0},
}
{8, 1, 6},
{3, 5, 7},
{4, 9, 0},
}
JAVA
Output the numbers of the array, each on a new line.
*Try First, Then see the solution.
Solution:
public class Main {
public static void main(String[] args) {
int[][] matrix = {
{8, 1, 6},
{3, 5, 7},
{4, 9, 0},
};
//output the numbers
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
System.out.println(matrix[i][j]);
}
}
}
}
.
If You Need it then Throw a comment and stay with us.
