Найти среднее арифметическое положительных элементов массива A(N,M) — Basic(Бейсик)

INPUT"vvedite kolichestvo strok N ",n
INPUT"vvedite kolichestvo stolbcov M ",m
RANDOMIZE TIMER
DIM a(n,m)
FOR i=1 TO n
FOR j=1 TO m
a(i,j)=INT(RND*20)-10
NEXT
NEXT
PRINT "matrica "
FOR i=1 TO n
FOR j=1 TO m
PRINT a(i,j);
NEXT
PRINT
NEXT
FOR i=1 TO n
FOR j=1 TO m
IF a(i,j)>0 THEN s=s+a(i,j):k=k+1
NEXT
NEXT
PRINT"srednee=";s/k

Leave a Comment