I have the following code, and it asks me to modify it so that it prints it to be inserted in a matrix (two-dimensional array), how could it do it?
static int siguiente(int nn, int tope) {
if (nn == tope) {
return 0;
} else {
return nn + 1;
}
}
public static void main(String[] args) {
int n = 5;
int num = 0;
for (int i = 0; i <= n; i++) {
for (int k = 0; k <= n; k++) {
System.out.println(num);
if (k != n) {
num = siguiente(num, n);
}
}
}
System.out.println("\n");
}
}