Perkalian Matrik ordo nXn

matrik.jpg 

program kali_matrik;
uses wincrt;

const
barisA =2;
kolomA =2;
barisB =2;
kolomB =2;

type
matrikA = array [1..barisA, 1..kolomA] of integer;
matrikB = array [1..barisB, 1..kolomB] of integer;
matrikC = array [ 1..2, 1..2 ] of integer;

var
A: matrikA;
B: matrikB;
C: matrikC;

i,j,k  : integer;

begin
writeln (‘ isi matrik A ‘);
for i:= 1 to barisA do begin
  for j:= 1 to kolomA do begin
   write (‘A[‘,i,’,’,j,’]=’); readln (A[i,j]);
  end;
end;

writeln (‘ isi matrik B’);
for i:= 1 to barisB do begin
  for j:= 1 to kolomB do begin
   write (‘A[‘,i,’,’,j,’]=’); readln (B[i,j]);
  end;
end;
{mengalikan matrik}
for i:= 1 to barisA do begin
   for j:= 1 to barisb do begin
      for k:= 1 to barisB do begin
      C[i,j]:= C[i,j]+A[i,k]* B[k,j];
   end;
end;
end;

{menampilkan hasil}
writeln (‘hasil A * B’);
for i:= 1 to 2 do begin
   for j:= 1 to  2 do begin
     writeln (‘ C[‘,i,’,’,j,’]=’,C[i,j]);
   end;
end;
end.

Iklan

4 thoughts on “Perkalian Matrik ordo nXn

  1. thanx bwt kodenya tp sy pgn tw crx penjumlahan matriks tanpa const jd qt biar bs input jumlah brs n kolom terserah qt..

    thanx bgt
    d tgg ;))

  2. assalamu’alaikum,
    terima kasih atas modulnya, sekalian mau tanya, gmn tuk mencari invers matrik gauss jordan dengan pascal? sedangkan syarat yang hrs dipenuhi unk mencr inver matrik pake gauss jordan bgt bnyk?

    thank’s very much

  3. tuh dalam pascal ya…?
    klo dalam C++ bsa g?

    oh ya..kalau untuk menentukan ordo nya gmana ya

    sebelum dan sesudah nya makasih ya..

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s