-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpracarray.java
56 lines (34 loc) · 1.13 KB
/
pracarray.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
45
46
47
48
49
50
51
52
53
54
55
56
import java.util.*;
public class pracarray {
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();
}
int [][] arrayy=new int[c][r];
for(int i=0;i<r;i++) {
for (int j = 0; j < c; j++) {
arrayy[i][j]=array[j][i];
}
}
for(int i=0;i<r;i++) {
for (int j = 0; j < c; j++) {
System.out.println (arrayy[i][j]);
}
}
System.out.println("enter the no to find:");
int k= sc.nextInt();
for(int i=0;i<r;i++) {
for (int j = 0; j < c; j++) {
if (array[i][j]==k)
System.out.print("("+i+","+j+")");
}
}
}
}