uses wincrt;
var
x,y : integer;
a,b,tot,min : array [1..2,1..2] of integer;
begin
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
write('Masukkan Nilai Matriks A = ');
read(a[x,y]);
end;
end;
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
write('Masukkan Nilai Matriks B = ');
read(b[x,y]);
end;
end;
clrscr;
writeln('Matriks A');
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
write(a[x,y], ' ');
end;
writeln;
end;
writeln('Matriks B');
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
write(b[x,y], ' ');
end;
writeln;
end;
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
tot[x,y]:=a[x,y]+b[x,y];
end;
end;
writeln('Matriks A + Matriks B');
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
write(tot[x,y], ' ');
end;
writeln;
end;
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
min[x,y]:=a[x,y]-b[x,y];
end;
end;
writeln('Matriks A - Matriks B');
for x := 1 to 2 do
begin
for y := 1 to 2 do
begin
write(min[x,y], ' ');
end;
writeln;
end;
end.