Coding Pascal Penjumlahan Matrik
program penjumlahan_matrik;
uses crt;
const
j_baris=2;
j_kolom=2;
var
a,b,c : array[1..j_baris,1..j_kolom] of integer;
baris, kolom : integer;
begin
clrscr;
writeln(’Penetapan nilai matrik A’);
for baris:=1 to j_baris do
for kolom:=1 to j_kolom do begin
write(’Baris ke-’,baris,’ Kolom ke-’,kolom,’:');
readln(A[baris,kolom]);
end;
writeln(’Penetapan nilai matrik B’);
for baris:=1 to j_baris do
for kolom:=1 to j_kolom do begin
write(’Baris ke-’,baris,’ Kolom ke-’,kolom,’:');
readln(B[baris,kolom]);
end;
writeln(’Perhitungan sedang dilakukan’);
for baris:=1 to j_baris do
for kolom:=1 to j_kolom do begin
C[baris,kolom]:= A[baris,kolom]+B[baris,kolom];
end;
writeln(’Nilai matrik C’);
for baris:=1 to j_baris do
for kolom:=1 to j_kolom do begin
write(’Baris ke-’,baris,’ Kolom ke-’,kolom,’:');
writeln(C[baris,kolom]);
end;
readln;
end.
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar