program perkalian matrik

Rabu, 09 Februari 2011 uses wincrt;
type
matrik_A=array[1..3,1..3]of byte;
matrik_B=array[1..3,1..3] of byte;
matrik_C=array[1..3,1..3] of byte;

var
a:matrik_A;
b:matrik_B;
c:matrik_C;
i,j,k:integer;

begin
for i:=1 to 3do
begin
for j:=1 to 3do
begin
c[i,j]:=0;
end;
end;
for i:=1 to 3 do
begin
for j:=1 to 3do
begin
writeln ('masukan nilai matrik A=');readln(a[i,j]);
end;
end;
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
writeln('masukan nillai matrik B=');readln(b[i,j]);
end;
end;
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
for k:=1 to 3 do
begin
c [i,j]:=c[i,j]+a[i,k]*b[k,j];
end;
end;
end;
for i:=1 to 3 do
begin
for j:=1 to 3 do
begin
writeln ('nilai perkalian +',c[i,j]);
end;
end;
end.

0 komentar:

Posting Komentar

 
 
 
 
Copyright © Oes blog