CLS
10 REM "PENGURANGAN
MATRIK"
20 REM
25 PRINT "PROGRAM
PENGURANGAN MATRIK"
26 PRINT
30 INPUT "Baris
matrik=";M
35 IF M=0 THEN GOSUB 30
40 INPUT "Kolom
matrik=";N
45 IF N=0 THEN GOSUB 40
50 DIM A(M,N), B(M,N), C(M,N)
60 'Memasukan data matrik A'
65 PRINT
70 PRINT "Data untuk
matrik A"
80 FOR I=1 TO M
90 FOR J=1 TO N
100 PRINT
"A(";I;",";J;")" ; : INPUT A(I,J)
110 NEXT J
120 NEXT I
130 '
135 'Memasukan data Matrik B'
140 PRINT
150 PRINT "Data untuk
matrik B"
160 FOR I=1 TO M
170 FOR J=1 TO N
180 PRINT
"B(";I;",";J;")" ; : INPUT B(I,J)
190 NEXT J
200 NEXT I
210 GOSUB 500
215 '
220 'Menampilkan Matrik hasil
Pengurangan'
225 PRINT
230 PRINT "Matrik Hasil
Pengurangan Matrik A dan Matrik B adalah;"
235 PRINT
240 FOR I=1 TO M
250 FOR J=1 TO N
260 PRINT USING
"######.###";C(I,J);
270 NEXT J
275 PRINT
280 NEXT I
290 END
300 '
310 PRINT
500 'Mengurangkan Matrik A dan
B'
510 FOR I=1 TO M
520 FOR J=1 TO N
530 C(I,J)= A(I,J) - B(I,J)
540 NEXT J
550 NEXT I
560 RETURN
Comments