Найти сумму максимальных элементов каждого столбца двумерного массива — Basic(Бейсик)

INPUT "vvedite kol-vo strok ", m
INPUT "vvedite kol-vo stolbcov ", n
DIM a(m, n)
RANDOMIZE TIMER
FOR i = 1 TO m
FOR j = 1 TO n
a(i, j) = INT(RND * 10)
NEXT
NEXT
PRINT "matrica"
FOR i = 1 TO m
FOR j = 1 TO n
PRINT a(i, j);
NEXT
PRINT
NEXT
FOR j = 1 TO n
max = a(1, j)
FOR i = 1 TO m
IF a(i, j) > max THEN max = a(i, j)
NEXT
PRINT "stolbec"; j; "max="; max
s = s + max
NEXT
PRINT "summa max elementov stolbcov="; s

Leave a Comment