MS-DOS QBasic Версия 1.0 Copyright (C) Microsoft Corporation, 1987-1991.
CLS DIM n AS INTEGER INPUT "n=", n DIM a(1 TO n) AS INTEGER RANDOMIZE TIMER s = 0 FOR i = 1 TO n a(i) = 101 * RND - 50 PRINT a(i); s = s + a(i) NEXT i PRINT m = s / n k = 0 FOR i = 1 TO n IF a(i) > m THEN k = k + 1 NEXT i PRINT "k="; k
Если не изменяет память- то вот: 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
Версия 1.0
Copyright (C) Microsoft Corporation, 1987-1991.
CLS
DIM n AS INTEGER
INPUT "n=", n
DIM a(1 TO n) AS INTEGER
RANDOMIZE TIMER
s = 0
FOR i = 1 TO n
a(i) = 101 * RND - 50
PRINT a(i);
s = s + a(i)
NEXT i
PRINT
m = s / n
k = 0
FOR i = 1 TO n
IF a(i) > m THEN k = k + 1
NEXT i
PRINT "k="; k
Пример
n=15
-13 17 43 -39 -20 -13 -5 32 12 -10 22 -24 31 6 -19
k= 7
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