CLS
PRINT
PRINT "Vvedite razmer massiva"
INPUT "Kolichestvo strok... ", n
INPUT "Kolichestvo stolbtsov... ", m
PRINT
PRINT "Zapolnenie massiva*:"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT "("; i; ","; j; ")"; " Element massiva... ";
INPUT " ", a(i, j)
NEXT j
NEXT i
PRINT "Iskhodnii massiv:"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j);
NEXT j
PRINT
NEXT i
DIM s(n)
FOR i = 1 TO n
s(i) = 0: k = 0
FOR j = 1 TO m
IF a(i, j) > 0 THEN s(i) = s(i) + a(i, j): k = k + 1
NEXT j
IF k > 0 THEN
s(i) = s(i) / k
ELSE
s(i) = 0
END IF
NEXT i
FOR i = 1 TO n
FOR j = 1 TO m
IF a(i, j) < 0 THEN a(i, j) = a(i, j) + s(i)
NEXT j
NEXT i
PRINT
PRINT "Massiv posle preobrazovaniy"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j);
NEXT j
PRINT
NEXT i
Тестирование выполнено в программе QB64 ( Скачать )