Minggu, 03 Juni 2012
bahasa pemrograman pascal penjumlahan matrik (matrik dua dimensi)
program Penjumlahan_Matrik;
uses crt ;
var
a, b, c : array [1..100,1..100] of integer;
i, j, m, n : integer;
begin
clrscr;
write('Jumlah baris = '); read(n);
write('Jumlah kolom = '); read(m);
for i := 1 to n do
for j := 1 to m do
begin
gotoxy(6*j-3, i+10); write('a[',i,',',j,'] = ');
readln(a[i,j]);
gotoxy(6*j-3, i+10); clreol; write(a[i,j]);
end;
for i := 1 to n do
for j := 1 to m do
begin
gotoxy(6*j-3, i+10); write('b[',i,',',j,'] = ');
readln(b[i,j]);
gotoxy(6*j-3, i+10); clreol; write(b[i,j]);
end;
clrscr;
for i := 1 to n do
for j := 1 to m do
begin
c[i,j] := a[i,j] + b[i,j];
gotoxy(6*j-3, i+10);
write(c[i,j]);
end;
readln;
end.
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar