DIM n AS DOUBLE, p AS DOUBLE, k AS INTEGER CLS k = 0 p = 1 DO INPUT "Vvedite chislo ili 0 dlya kontsa vvoda: ", n IF n <> 0 THEN p = p * n k = k + 1 END IF LOOP UNTIL n = 0 p = EXP(LOG(p) / k) PRINT "Srednee geometricheskoe = "; p END
Тестовое решение: Vvedite chislo ili 0 dlya kontsa vvoda: 3.2 Vvedite chislo ili 0 dlya kontsa vvoda: 11.7 Vvedite chislo ili 0 dlya kontsa vvoda: 8.4 Vvedite chislo ili 0 dlya kontsa vvoda: 0 Srednee geometricheskoe = 6.800461329716477
DIM n AS DOUBLE, p AS DOUBLE, k AS INTEGER
CLS
k = 0
p = 1
DO
INPUT "Vvedite chislo ili 0 dlya kontsa vvoda: ", n
IF n <> 0 THEN
p = p * n
k = k + 1
END IF
LOOP UNTIL n = 0
p = EXP(LOG(p) / k)
PRINT "Srednee geometricheskoe = "; p
END
Тестовое решение:
Vvedite chislo ili 0 dlya kontsa vvoda: 3.2
Vvedite chislo ili 0 dlya kontsa vvoda: 11.7
Vvedite chislo ili 0 dlya kontsa vvoda: 8.4
Vvedite chislo ili 0 dlya kontsa vvoda: 0
Srednee geometricheskoe = 6.800461329716477