CONST n = 5 ' Stroki
CONST m = 5 ' Stolbtsi
DIM A(m, n), Sar, SarMax, sn
CLS
RANDOMIZE TIMER ' Sluchainaya matritsa
FOR iy = 1 TO n: FOR ix = 1 TO m
A(ix, iy) = INT(RND * 21) - 10
PRINT A(ix, iy);
NEXT ix: PRINT: NEXT iy
' Ishchem summu
FOR iy = 1 TO n: Sar = 0: FOR ix = 1 TO m
Sar = Sar + A(ix, iy)
NEXT ix
Sar = Sar / m ' Mozhno i bez etoi stroki
IF iy = 1 THEN SarMax = Sar: sn = 1
IF Sar > SarMax THEN SarMax = Sar: sn = iy
NEXT iy: PRINT
PRINT "Nomer stroki max srednearifm elementov stroki:"; sn
Тестирование выполнено в программе QB64 ( Скачать )