Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE rz5;
- FROM InOut IMPORT WriteLn, WriteString, WriteCard, ReadCard;
- CONST dim= 10;
- TYPE mat1= ARRAY [1..dim],[1..dim] OF CARDINAL;
- mat2= ARRAY [1..dim],[1..dim] OF CARDINAL;
- mat3= ARRAY [1..dim],[1..dim] OF CARDINAL;
- VAR A: mat1; B: mat2; C: mat3;
- i,j,k,dim1,dim2,dim3: CARDINAL;
- BEGIN
- (*DIMENZIJA 1. MATRICE*)
- WriteString('Unesite dimenziju kolone 1. matrice: ');
- ReadCard(dim1);
- WriteString('Unesite dimenziju vrste 1. matrice: ');
- ReadCard(dim2);
- (*UCITAVANJE PRVE MATRICE*)
- WriteString('Unesite prvu matricu dimenzija ');
- WriteCard(dim1,1);
- WriteString('x');
- WriteCard(dim2,1);
- WriteString(': ');
- WriteLn;
- FOR i:=1 TO dim1 DO
- FOR j:=1 TO dim2 DO
- ReadCard(A[i,j]);
- END;
- WriteLn;
- END;
- (*DIMENZIJA 2. MATRICE*)
- WriteString('Unesite dimenziju vrste 2. matrice: ');
- ReadCard(dim3);
- (*UCITAVANJE DRUGE MATRICE*)
- WriteString('Unesite drugu matricu dimenzija ');
- WriteCard(dim2,1);
- WriteString('x');
- WriteCard(dim3,1);
- WriteString(': ');
- WriteLn;
- FOR j:=1 TO dim2 DO
- FOR k:=1 TO dim3 DO
- ReadCard(B[j,k]);
- END;
- WriteLn;
- END;
- (*STAMPANJE MATRICA*)
- WriteString('+Prva matrica izgleda ovako+ ');
- WriteLn;
- FOR i:=1 TO dim1 DO
- FOR j:=1 TO dim2 DO
- WriteCard(A[i,j],5);
- END;
- WriteLn;
- END;
- WriteString('+Druga matrica izgleda ovako+ ');
- WriteLn;
- FOR j:=1 TO dim2 DO
- FOR k:=1 TO dim3 DO
- WriteCard(B[j,k],5);
- END;
- WriteLn;
- END;
- (* MNOZENjE MATRICA*)
- 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[k,j];
- END;
- END;
- END;
- (*ISPIS PROIZVODA MATRICE*)
- WriteString('+Proizvod matrica izgleda ovako+ ');
- WriteLn;
- FOR i:=1 TO dim1 DO
- FOR k:=1 TO dim3 DO
- WriteCard(C[i,k],5);
- END;
- WriteLn;
- END;
- END rz5.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement