дан массив. найти количество элементов, значение которых больше среднего арифметического qbasic
Answers & Comments
DarkAngel14
Если не изменяет память- то вот: INPUT "vvedite n", n INPUT "vvedite m", m DIM a(n, m) FOR i = 1 TO n FOR j = 1 TO m INPUT "vvedite element", a(i, j) NEXT j NEXT i PRINT "_____" PRINT "matrica" FOR i = 1 TO n FOR j = 1 TO m PRINT a(i, j) NEXT NEXT PRINT "______" FOR i = 1 TO n FOR j = 1 TO m v = v + a(i, j): k = k + 1 NEXT NEXT sr = v / k PRINT "srednee", sr FOR i = 1 TO n FOR j = 1 TO m IF a(i, j) > sr THEN c = c + 1 NEXT NEXT PRINT "kol-vo", c
Answers & Comments
INPUT "vvedite n", n
INPUT "vvedite m", m
DIM a(n, m)
FOR i = 1 TO n
FOR j = 1 TO m
INPUT "vvedite element", a(i, j)
NEXT j
NEXT i
PRINT "_____"
PRINT "matrica"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j)
NEXT
NEXT
PRINT "______"
FOR i = 1 TO n
FOR j = 1 TO m
v = v + a(i, j): k = k + 1
NEXT
NEXT
sr = v / k
PRINT "srednee", sr
FOR i = 1 TO n
FOR j = 1 TO m
IF a(i, j) > sr THEN c = c + 1
NEXT
NEXT
PRINT "kol-vo", c