Вычислить элементы матрицы а=а(i,j), если — Basic(Бейсик)

a(i,j)=b(i,j) при |b(i,j)I>Ic(i,j)|
a(i,j)=с(i,j) при |b(i,j)I<=Ic(i,j)|

b=(2.5 -3.0 6.2)
(-0.1 4.2 2.8)
(2.0 7.5 -1.8)

с=(-2.0 2.3 -7.1)
(0.8 3.6 -5.6)
(3.0 6.0 4.0)

|…| -это модуль,а b и с это матрицы

DATA 2.5,-3.0,6.2,-0.1,4.2,2.8,2.0,7.5,-1.8
DATA -2.0,2.3,-7.1,0.8,3.6,-5.6,3.0,6.0,4.0
DIM a(3, 3), b(3, 3), c(3, 3)
PRINT "matrica b"
FOR i = 1 TO 3
FOR j = 1 TO 3
READ b(i, j)
PRINT b(i, j);
NEXT
PRINT
NEXT
PRINT "matrica c"
FOR i = 1 TO 3
FOR j = 1 TO 3
READ c(i, j)
PRINT c(i, j);
NEXT
PRINT
NEXT
PRINT "matrica a"
FOR i = 1 TO 3
FOR j = 1 TO 3
IF ABS(b(i, j)) > ABS(c(i, j)) THEN a(i, j) = b(i, j) ELSE a(i, j) = c(i, j)
PRINT a(i, j);
NEXT
PRINT
NEXT

Leave a Comment