class SprialMatrix {
public static void main(String[] args) {
int row = 3;
int col = 3;
int[][] matrix = new int[row][col];
int count = 1;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
System.out.print(count + " ");
count++;
}
System.out.println();
}
}
}
0 Comments