Penjumlahan matriks

program matriks_jumlah;
var
matA,matB,matC:array[1..2,1..2] of integer;
b,k,l:integer;
begin
writeln('===========================');
writeln('Program matriks penjumlahan');
writeln('===========================');
for b:=1 to 2 do
begin
for k:=1 to 2 do
begin
writeln('Data A[',b,',',k,']:');readln(matA[b,k]);
end;
writeln;
end;
begin
for b:=1 to 2 do
begin
for k:=1 to 2 do
begin
writeln('Data B[',b,',',k,']:');readln(matB[b,k]);
end;writeln;
end;
end;
begin
for b:=1 to 2 do
begin
for k:=1 to 2 do
begin
matC[b,k]:=matA[b,k]+matB[b,k];
end;
end;
readln;
writeln('Data matriks A');
end;
begin
for b:=1 to 2 do
begin
for k:=1 to 2 do
begin
write(matA[b,k]);
end;
readln;
end;
end;
begin
writeln('Data matriks B');
for b:=1 to 2 do
begin
for k:=1 to 2 do
begin
write(matB[b,k]);
end;
readln;
end;
end;
begin
writeln('Data matriks C');
writeln;
for b:=1 to 2 do
begin
for k:=1 to 2 do
begin
write(matC[b,k]);
end;
readln;
end;
end;
end.



0 komentar:

Posting Komentar

Pengikut