Page 591 - Computer science 868 Class 12
P. 591
23 product A=new product(s);
24 for(int i=0;i<s;i++)
25 {
26 for(int j=0;j<s;j++)
27 {
28 A.mat[i][j]=0;
29 for(int k=0;k<s;k++)
30 {
31 A.mat[i][j]=p1.mat[i][k]*p2.mat[k][j]; // matrix multiplication
32 }
33 }
34 }
35 return A;
36 }
37 void display()
38 {
39 for(int i=0;i<s;i++)
40 { for(int j=0;j<s;j++)
41 {
42 System.out.print(mat[i][j]+"\t");
43 }
44 System.out.println();
45 }
46 }
47 public static void main(String args[])
48 {
49 Scanner sc=new Scanner(System.in);
50 System.out.println("ENTER SIZE");
51 int d= sc.nextInt();
52 product X=new product(d);
53 product Y=new product(d);
54 product Z=new product(d);
55 System.out.println("ENTER ELEMENTS OF FIRST MATRIX :-");
56 X.input();
589
Internal Assessment 589

