Page 312 - computer science (868) class 11
P. 312
3 {
4 public static void main()
5 {
6 Scanner sc= new Scanner(System.in);
7 int i, j;
8 int ar[ ][ ]=new int[3][3];
9 int tar[ ][ ]=new int[3][3];
10 for (i=0; i<3; i++)
11 {
12 for(j=0; j<3; j++)
13 {
14 System.out.print("Enter a number: ");
15 ar[i][j] =sc.nextInt();
16 }
17 }
18 System.out.print("Original Array:\n ");
19 for (i=0; i<3; i++)
20 {
21 for(j=0; j<3; j++)
22 {
23 System.out.print(ar[i][j]+" ");
24 }
25 System.out.println();
26 }
27 for (i=0; i<3; i++) // Transposing the Array
28 {
29 for(j=0; j<3; j++)
30 {
31 tar[i][j]=ar[j][i];
32 }
33 }
34 System.out.println("Transposed Array:");
35 for (i=0; i<3; i++)
36 {
310310 Touchpad Computer Science-XI

