penjumlahan matrix dasar

penjumlahan matrix dasar

copy code start from here:

Program latihan3;
Uses wincrt;
Var n, i : integer;
    A,B,C : Array [1..10] of Integer;

Begin
  
     Writeln(‘PROGRAM PERHITUNGAN MATRIKS BARIS (ordo nx1)’);
     Write(‘Masukkan jumlah kolom yang diinginkan : ‘); Readln(n);
     writeln;

     {Matriks A}
     Writeln(‘Matriks A : ‘);
     FOR i:=1 to n DO
     begin
          write(‘Kolom ke-‘,i,’ : ‘); readln(A[i]);
     end;
     writeln;

     {Matriks B}
     Writeln(‘Matriks B : ‘);
     FOR i:=1 to n DO
     begin
          write(‘Kolom ke-‘,i,’ : ‘); readln(B[i]);
     end;

     {Penambahan 2 matriks dan tampilannya}
     Clrscr;
     Write(‘Matriks A : [‘);
     FOR i:=1 to n DO write(A[i]);
     write(‘]’);
     writeln; writeln;

     Write(‘Matriks B : [‘);
     FOR i:=1 to n DO write(B[i]);
     write(‘]’);
     writeln; writeln;

     writeln(‘Jadi hasil penambahan matriks A dan B adalah : ‘);
     write(‘Matriks C : [‘);
     FOR i:=1 to n DO
     begin
          C[i]:=A[i]+B[i];
          write(C[i]);
     end;
     writeln(‘]’);
     Readkey;
end.

Iklan

One thought on “penjumlahan matrix dasar

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