PROGRAM pertambahan_2_matrik_ordo_4x3;
USES WINCRT;
VAR
Matrik1 : ARRAY [1..4,1..3] OF INTEGER;
Matrik2 : ARRAY [1..4,1..3] OF INTEGER;
Matrik3 : ARRAY [1..4,1..3] OF INTEGER;
A, B: INTEGER;
BEGIN
WRITEln('masukan nilai matrik ke-1 :');
writeln('---------------------------');
FOR A :=1 TO 4 DO
BEGIN
FOR B := 1 TO 3 DO
BEGIN
wRITE('Data nilai ke-[',A,',',B,']');
READLN(matrik1[A][B]);
END;
END;
WRITEln('');
writeln('jadi matrik_1 adalah : ');
FOR A := 1 TO 4 DO
BEGIN
FOR B := 1 TO 3 DO
BEGIN
WRITE(matrik1[A][B],' ');
END;
WRITELN;
END;
writeln('');
BEGIN
WRITEln('masukan nilai matrik ke-2 :');
writeln('---------------------------');
FOR A :=1 TO 4 DO
BEGIN
FOR B := 1 TO 3 DO
BEGIN
wRITE('Data nilai ke-[',A,',',B,']');
READLN(matrik2[A][B]);
END;
END;
WRITEln('');
writeln('jadi matrik_2 adalah : ');
FOR A := 1 TO 4 DO
BEGIN
FOR B := 1 TO 3 DO
BEGIN
WRITE(matrik2[A][B],' ');
END;
WRITELN;
END;
End;
FOR A := 1 TO 4 DO
BEGIN
FOR B := 1 TO 3 DO
BEGIN
Matrik3[A,B]:=matrik1[A,B]+matrik2[A,B];
End;
End;
Writeln('');
writeln('jadi jumlah anatara Matrik 1 dan Matrik 2 adalah : ');
FOR A := 1 TO 4 DO
BEGIN
FOR B := 1 TO 3 DO
BEGIN
WRITE(matrik3[A,B]:4);
END;
WRITELN;
End;
END.
Selamat mencoba dan Semoga Bermanfaat.
matrik ke 2 ga tampil
BalasHapus