-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask2j.java
More file actions
28 lines (25 loc) · 840 Bytes
/
Task2j.java
File metadata and controls
28 lines (25 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Task2j{
public static void main(String[] args) {
int original[][]={{1,3,4},{2,4,3},{3,4,5}};
int transpose[][]=new int[3][3];
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
transpose[i][j]=original[j][i];
}
}
System.out.println("Matrix without transpose:");
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
System.out.print(original[i][j]+" ");
}
System.out.println();
}
System.out.println("Matrix After Transpose:");
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
System.out.print(transpose[i][j]+" ");
}
System.out.println();
}
}
}