program gunawan;
uses wincrt;
var
x,r,y:array[1..10,1..10] of integer;
i,j,a,b:integer;
begin
writeln('SELAMAT DATANG DI PROGRAM PENGURANGAN MATRIK');
writeln;
writeln('MASUKAN DATA :');
write('ada berapa baris yang anda inginkan ? : ');readln(a);
write('ada berapa kolom yang anda inginkan ? : ');readln(b);
writeln;
writeln('MASUKAN DATA MATRIK A');
for i:=1 to a do
begin
for j:=1 to b do
begin
write('baris ',i,' kolom ',j,' : ');readln(x[i,j]);
end;
writeln;
end;
writeln;
writeln('MASUKAN DATA MATRIK B');
for i:=1 to a do
begin
for j:=1 to b do
begin
write('baris ',i,' kolom ',j,' : ');readln(r[i,j]);
end;
writeln;
end;
writeln;
writeln;
writeln('Didapat');
writeln('Matrik A : ');
for i:=1 to a do
begin
for j:=1 to b do
begin
write(x[i,j]:5);
end;
writeln;
end;
writeln;
writeln('Matrik B : ');
for i:=1 to a do
begin
for j:=1 to b do
begin
write(r[i,j]:5);
end;
writeln;
end;
writeln;
writeln('Matrik A x Matrik B : ');
y[i,j]:=0;
for i:=1 to a do
begin
for j:=1 to b do
begin
y[i,j]:=y[i,j]+(x[i,j]*r[i,j]);
write(y[i,j]:5);
end;
writeln;
end;
end.
No comments:
Post a Comment