-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathd2array.java
44 lines (27 loc) · 947 Bytes
/
d2array.java
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.*;
public class d2array {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r= sc.nextInt();
int c= sc.nextInt();
int[][]array=new int[r][c];
//input
System.out.println("input time :)");
for(int i=0;i<r;i++) {
for (int j = 0; j < c; j++)
array[i][j] = sc.nextInt();
}
for(int i=0;i<r;i++) {
for (int j = 0; j < c; j++)
System.out.print(array[i][j]+" ");
System.out.println ();
}
System.out.println("");
for (int j = 0; j < c; j++){
for(int i=0;i<r;i++) {
System.out.print(array[i][j]+" ");
}
System.out.println ();
}
}
}