• C++. Напишите программу для вычисления среднего геометрического элементов массива array[15] удовлетворяющих условию 5<=array[i]<=15.

Ответы 1

  • #include \"stdio.h\" #include \"Windows.h\"#include \"math.h\"int main(int argc, char* argv[]) { char Answer[128]; int Array[15], Count = 0, Result = 1; printf(\"In:\\"); fgets(Answer, 128, stdin); char * pch = strtok(Answer, \" \"); while (pch != NULL) { Array[Count] = atoi(pch); Count += 1; pch = strtok(NULL, \" \"); } Count = 0; for (int i = 0; i < 15; i++) { if (Array[i] >= 5 && Array[i] <= 15) { Result *= Array[i]; Count += 1; } } printf(\"%lf\", pow(Result, 1.0 / Count)); system(\"pause\"); return 0; }
  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years