CLS
INPUT "Kolvo strok massiva=";n
INPUT "Kolvo stolbcov massiva=";m
DIM a(n,m)
RANDOMIZE TIMER
FOR i=1 TO n
FOR j=1 TO m
a(i,j)=INT(RND*101)-50
NEXT j
NEXT i
PRINT "Ishodniy massiv"
FOR i=1 TO n
FOR j=1 TO m
PRINT a(i,j);
NEXT j
PRINT
NEXT i
PRINT
s=0
FOR i=1 TO n
FOR j=1 TO m
IF a(i,j)>0 THEN s=s+a(i,j)
NEXT j
NEXT i
FOR i=1 TO n
IF i<=m THEN a(i,i)=s
NEXT i
PRINT "Izmenen massiv"
FOR i=1 TO n
FOR j=1 TO m
PRINT a(i,j);
NEXT j
PRINT
NEXT i