program x_mtrik;
uses crt;
var
matrikA : array[1..2, 1..3] of integer;
matrikB : array[1..3, 1..2] of integer;
matrikC : array[1..2, 1..2] of integer;
k,l,m : integer;
begin
clrscr;
writeln('Elemen Matrik A : ');
for k:=1 to 2 do
begin
for m:=1 to 3 do
begin
write('Baris-',k,'Kolom-',m,'=');
readln(matrikA[k,m]);
end;
end;
writeln;
writeln('Elemen Matrik B : ');
for m:=1 to 3 do
begin
for l:=1 to 2 do
begin
write('Baris-',m,'kolom-',l,'=');
readln(matrikB[m,l]);
end;
end;
for k:= 1 to 2 do
begin
for l:=1 to 2 do
begin
matrikC[k,l]:=0;
for m:=1 to 3 do
begin
MatrikC[k,l]:=matrikC[k,l] + matrikA[k,m] * matrikB[m,l];
end;
end;
end;
writeln;
for k:=1 to 2 do
begin
for m:=1 to 3 do
begin
write(matrikA[k,m]:4);
end;
writeln;
end;
writeln('X');
for m:=1 to 3 do
begin
for l:=1 to 2 do
begin
write(matrikB[m,l]:4);
end;
writeln;
end;
writeln('=');
for k:=1 to 2 do
begin
for l:=1 to 2 do
begin
write(matrikC[k,l]:4);
end;
writeln;
end;
readln;
end.
Tidak ada komentar:
Posting Komentar