Program matrik

Program Penjumlahan_Matrik;
Uses Crt;
Var
Matrik1,Matrik2, Hasil : Array[1..3,1..2] of Integer;
i,j : Integer;
Begin
ClrScr;
{ input matrik ke satu }
Writeln(‘ Elemen matrik satu’);
For i := 1 to 3 Do
Begin
For j := 1 to 2 Do
Begin
Write(‘Elemen baris -‘,i,’ Kolom -‘,j,’= ‘);
Readln(matrik1[i,j]);
End;
End;
{input matrik ke dua}
Writeln(‘input elemen matrik dua’);
For i:= 1 to 3 Do
Begin
For j:= 1 to 2 Do
Begin
Write(‘Elemen baris -‘,i,’ kolom -‘,j,’= ‘);
Readln(matrik2[i,j]);
End;
End;
{proses penjumlahan tiap elemen}
For i := 1 to 3 Do
Begin
For j:= 1 to 2 Do
Begin
Hasil[i,j]:=Matrik1[i,j]+Matrik2[i,j];
End;
End;
{proses cetak hasil}
For i:= 1 to 3 Do
Begin
For j:= 1 to 2 Do
Begin
Write(Hasil[i,j]:6);
End;
Writeln;
End;
Readln;
End.

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

%d blogger menyukai ini: