Page 302 - Computer science 868 Class 12
P. 302
15 {
16 for(j = 0;j<n;j++)
17 {
18 System.out.print ("Enter Nos. in Array : ");
19 a[i][j] = sc.nextInt();
20 }
21 }
22
23 // Display of original array
24 for(i = 0;i<m;i++)
25 {
26 for(j = 0;j<n;j++)
27 System.out.print (a[i][j]+" ");
28 System.out.println ();
29 }
30 System.out.println ();
31 for(i = 0;i<m;i++)
32 {
33 for(j = 0;j<n;j++)
34 {
35 if(i<j)
36 {
37 t=a[i][j];
38 a[i][j]=a[j][i];
39 a[j][i]=t;
40 }
41 }
42 }
43 //Dispay of transposed array
44
45 for(i = 0;i<m;i++)
46 {
47 for(j = 0;j<n;j++)
48 System.out.print (a[i][j]+" ");
300300 Touchpad Computer Science-XII

