uses crt;
type matrik = array[1..10,1..10] of integer;
var baris,kolom,i,j,d : integer;
a,b,c,data : matrik;
procedure input_data(var data : matrik);
begin
d:=0;
for i := 1 to baris do
for j := 1 to kolom do
begin
inc(d);
write('Data ',d,'= ');
read(data[i,j]);
end;
end;
procedure cetak(var data:matrik);
begin
for i:= 1 to baris do
begin
for j := 1 to kolom do
write(data[i,j]:3);
writeln;
end;
end;
procedure jumlah(var c : matrik);
begin
for i:= 1 to baris do
for j := 1 to kolom do
c[i,j]:= a[i,j]+b[i,j];
end;
begin
write('Baris = ');
readln(baris);
write('Kolom = ');
readln(kolom);
writeln('Matrik A: ');
input_data(a);
writeln('Matrik B: ');
input_data(b);
jumlah(c);
writeln('Matrik A: ');
cetak(a);
writeln('Matrik B: ');
cetak(b);
writeln('Matrik C: ');
cetak(c);
readln;
readln;
end.
Tidak ada komentar:
Posting Komentar