INPUT m
INPUT n
DIM a(m, n), s(m)
RANDOMIZE TIMER
FOR i = 1 TO m
FOR j = 1 TO n
a(i, j) = INT(RND * 20)
NEXT
NEXT
PRINT "massiv"
FOR i = 1 TO m
FOR j = 1 TO n
PRINT a(i, j); ' ';
NEXT
PRINT
NEXT
FOR i = 1 TO m
FOR j = 1 TO n
s(i) = s(i) + a(i, j)
NEXT
NEXT
FOR i = 1 TO m
FOR j = 2 TO m
IF s(j) < s(j - 1) THEN SWAP s(j), s(j - 1): FOR k = 1 TO n: SWAP a(j, k), a(j - 1, k): NEXT
NEXT
NEXT
PRINT "novyj massiv"
FOR i = 1 TO m
FOR j = 1 TO n
PRINT a(i, j); ' ';
NEXT
PRINT
NEXT