Penjumlahan matrix

penjumlahan matrix

copy code start from here:

program matrik_dua_dimensi;

uses wincrt;
const
  jbaris=2;
  jkolom=2;

type
matrik = array [1..jbaris,1..jkolom] of integer;

var
A,B,C: matrik;
j,k  : integer;

begin
{mengisi matrik A}
writeln(‘Matrik A’);
for j:= 1 to jbaris  do begin
    for k:= 1 to jkolom do begin
       write(‘A[‘,j,’,’,k,’]=’); readln(A[j,k]);
    end;
    writeln;
    end;
writeln;

(*mengisi matrik B *)
writeln(‘Matrik B’);
for j:= 1 to jbaris do begin
   for k:= 1 to jkolom do begin
     write(‘B[‘,J,’,’,K,’]=’);readln(b[j,k]);
   end;
   writeln;
   end;
writeln;
writeln (‘Hasil penjumlahan matrik A dan B ‘);
for j:= 1 to jbaris do begin
    for k:= 1 to jkolom do begin
    c[j,k]:= a[j,k]+b[j,k];
    writeln(‘C[‘,j,’,’,k,’]=’,c[j,k]);
    end;
writeln;
end;
end.

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s