when Am trying to build matrix by using following code, am getting output in one line and values are repeated

A[1,1] := 2;
A[1,2] := 4;
A[1,3] := 5;
A[2,1] := 6;
A[2,2] := 8;
A[2,3] := 9;
A[3,1] := 12;
A[3,2] := 2;
A[3,3] := 3;

B[1,1] := 6;
B[1,2] := 4;
B[1,3] := 0;
B[2,1] := 1;
B[2,2] := 2;
B[2,3] := 3;
B[3,1] := 4;
B[3,2] := 9;
B[3,3] := 7;

ShowResult;

 

showResult()

FOR i := 1 TO 3 DO
FOR j := 1 TO 3 DO
FOR k := 1 TO 3 DO

C[i,j] := C[i,j] + (A[j,k] * B[k,j]);

FOR i := 1 TO 3 DO

FOR j := 1 TO 3 DO
Line := Line + ', ' + FORMAT(C[i,j]);
output := output + COPYSTR(Line , 3) + '\';

output:

36, 121, 27, 36, 121, 27, 36, 121, 27\

can anyone suggest what i need to implement to get the output in two dimentional array   and correct values

Thank You

Related