CLS
INPUT "vv. kol-vo strok ", n
INPUT "vv. kol-vo stolbcov ", m
DIM d(n, m)
RANDOMIZE TIMER
FOR i = 1 TO n
FOR j = 1 TO m
d(i, j) = INT(RND * 20) - 10
NEXT
NEXT
PRINT "massiv"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT d(i, j); " ";
NEXT
PRINT
NEXT
FOR i = 1 TO n
f = 0
nom = 0
nom1 = 0
max = 0
FOR j = 1 TO m
IF d(i, j) < 0 THEN f = 1
IF f = 0 AND d(i, j) > max THEN max = d(i, j): nom = j
IF d(i, j) < 0 THEN nom1 = j
NEXT
IF (max <> 0) AND (f = 1) THEN SWAP d(i, nom), d(i, nom1)
NEXT
PRINT "novyj massiv"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT d(i, j); " ";
NEXT
PRINT
NEXT