Kata Bapak Tebe

love is not loving somebody perfect but love is loving somebody imperfect perfectly.

Penjumlahan Matrik

Selasa, 06 Oktober 2009

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.

0 komentar:

Posting Komentar