Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE matmno;
- FROM InOut IMPORT WriteInt, ReadInt, WriteString, WriteLn;
- CONST dim1=5;
- dim2=4;
- dim3=3;
- TYPE mat1= ARRAY [1..dim1], [1..dim2] OF INTEGER;
- mat2= ARRAY [1..dim2], [1..dim3] OF INTEGER;
- mat3= ARRAY [1..dim1], [1..dim3] OF INTEGER;
- VAR A: mat1; B: mat2; C: mat3;
- i: [1..dim1]; j: [1..dim2]; k: [1..dim3];
- BEGIN
- WriteString('Unos prve matrice: ');
- WriteLn;
- FOR i:=1 TO dim1 DO
- WriteString('Unesite ');
- WriteInt(i,1);
- WriteString('. vrstu, ');
- FOR j:=1 TO dim2 DO
- WriteInt(j,1);
- WriteString('. kolonu: ');
- ReadInt(A[i,j]);
- END;
- END;
- WriteLn;
- WriteString('Unos druge matrice: ');
- WriteLn;
- FOR j:=1 TO dim2 DO
- WriteString('Unesite ');
- WriteInt(j,1);
- WriteString('. vrstu, ');
- FOR k:=1 TO dim3 DO
- WriteInt(k,1);
- WriteString('. kolonu: ');
- ReadInt(B[j,k]);
- END;
- END;
- FOR i:=1 TO dim1 DO
- FOR k:=1 TO dim3 DO
- C[i,k]:=0;
- FOR j:=1 TO dim2 DO
- C[i,k] := C[i,k] + A[i,j] * B[j,k];
- END;
- END;
- END;
- WriteString('Proizvod dvije matrice iznosi: ');
- WriteLn;
- FOR i:=1 TO dim1 DO
- WriteLn;
- FOR k:=1 TO dim3 DO
- WriteInt(C[i,k],5);
- END;
- END;
- END matmno.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement