program PENJUMLAHAN_MATRIKS;
uses wincrt;
type ha=array[1..10,1..10] of integer;
var i,j,m,n:integer;
x:array[1..10,1..10] of integer;
y:array[1..10,1..10] of integer;
h:ha ;
begin
writeln;
writeln (' ====================================== ');
writeln (' PROGRAM PENJUMLAHAN MATRIKS ');
writeln (' ====================================== ');
write (' masukkan jumlah baris: ');readln(m);
write (' masukkan jumlah kolom: ');readln(n);
writeln (' ====================================== ');
writeln (' Matriks pertama ');
for i:=1 to m do
begin
for j:=1 to n do
begin
write(' nilai[',i,',',j,']=');readln(x[i,j]);
end;
writeln;
end;
writeln (' Matriks kedua ');
for i:=1 to m do
begin
for j:=1 to n do
begin
write(' nilai[',i,',',j,']=');readln(y[i,j]);
end;
writeln;
end;
Clrscr;
writeln (' MATRIKS ANDA ');
writeln (' ====================================== ');
writeln;
writeln (' Matriks pertama ');
writeln (' ====================================== ');
for i:=1 to m do
begin
for j:=1 to n do
write(' ',x[i,j]:5);;
writeln;
end;
writeln;
writeln (' Matriks kedua ');
writeln (' ====================================== ');
for i:=1 to m do
begin
for j:=1 to n do
write(' ',y[i,j]:5);;
writeln;
end;
writeln;
writeln (' Matriks hasil ');
writeln (' ====================================== ');
for i:=1 to m do
begin
for j:=1 to n do
h[i,j]:=x[i,j]+y[i,j];
end;
for i:=1 to m do
begin
for j:=1 to n do
write(' ',h[i,j]:5);;
writeln;
end;
writeln (' ====================================== ');
end.
Artikel Terkait:
0 komentar:
Posting Komentar