Program
Penjumlahan_Matriks;
Uses
Wincrt;
Type
Matriks= array [1..10,1..10] of
integer;
var
A,B,C: Matriks;
k,m
: integer;
Procedure
isimatriksA( var k,m : integer);
var i,j:
integer;
Begin
Writeln('Matriks A');
write('Masukan banyak baris matrik A =
');readln(k);
write('Masukan banyak kolom matrik A =
');readln(m);
For i:=1 to k do begin
For j:=1 to m do begin
Write('Masukkan baris ke-',i,',
kolom ke-',j,' :');readln(A[i,j]);
end;
end;
end;
Procedure
isimatriksB( var k,m : integer);
var i,j:
integer;
Begin
Writeln('Matriks B');
write('Masukan banyak baris matrik B =
');readln(k);
write('Masukan banyak kolom matrik B =
');readln(m);
For i:=1 to k do begin
For j:=1 to m do begin
Write('Masukkan baris ke-',i,',
kolom ke-',j,' :');readln(B[i,j]);
end;
end;
end;
Procedure
cetakmatriksA(var k,m : integer);
var i,j:
integer;
Begin
For i:=1 to k do begin
For j:=1 to m do begin
Write(' ',A[i,j]);
end;
Writeln;
end;
end;
Procedure
cetakmatriksB(var k,m : integer);
var i,j:
integer;
Begin
For i:=1 to k do begin
For j:=1 to m do begin
Write(' ',B[i,j]);
end;
Writeln;
end;
end;
Procedure
tambah( var k,m : integer);
var i,j:
integer;
Begin
For i:=1 to k do begin
For j:=1 to m do begin
C[i,j]:=A[i,j] + B[i,j];
Write(' ',C[i,j]);
end;
Writeln;
end;
end;
Begin
isimatriksA(k,m);
clrscr;
isimatriksB(k,m);
clrscr;
writeln('MATRIKS A');
cetakmatriksA(k,m);
writeln;
writeln('MATRIKS B');
cetakmatriksB(k,m);
writeln;
writeln('MATRIKS A + MATRIKS B =
MATRIKS C');
tambah(k,m);
end.
0 komentar:
Posting Komentar
Terimakasih Telah membaca artikel kami. Silahkan tinggalkan komentar anda disini.