We do not provide code. You'll have to use your code.
Anyway: The teacher will figure quite easily if it's your code or antoher ones. I can easily identify who wrote a code when I see it here in our company.
Your code:
- Classes are named with capital Letter:
public class Transpose1 {
}
- your values in
matrix
and
tmatrix
are initalized with 0.
To get them filled:
int x = 0;
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
matrix[i][j] = x++;
}
}
Then it looks fine.