-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinputExample.java
38 lines (34 loc) · 937 Bytes
/
inputExample.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
import java.util.*;
public class inputExample {
public static void main(String arg[]) {
Scanner scanner = new Scanner(System.in);
// scanner.useDelimiter("\n");
int row = Integer.parseInt(scanner.nextLine());
int col = Integer.parseInt(scanner.nextLine());
int n = scanner.nextInt();
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = scanner.nextInt();
}
int arr[][] = new int[row][col];
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
arr[i][j] = scanner.nextInt();
}
// }
String str = scanner.nextLine();
System.out.println();
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
System.out.print(arr[i][j] + " ");
}
System.out.println();
}
System.out.println(n);
for (int i : arr) {
System.out.print(i + " ");
}
System.out.println(col);
System.out.println(str);
}
}