Есть ответ 👍

Как сделать улитку в кумире ?

223
446
Посмотреть ответы 1

Ответы на вопрос:

zeka27
4,5(94 оценок)

#include < stdlib.h> #include < iostream> #include < iomanip> using namespace std; int main() { const int n = 10; double a[n]; double s=0; int i1=0, i2=n-1; srand(time(0)); for (int i = 0; i < n; i++){ a[i]=-50 + (101.0 / rand_max) * rand(); cout < < fixed < < setw (7) < < setprecision (2) < < a[i]; } cout < < endl; while (a[i1]< =0) i1++; while (a[i2]< =0) i2--; for (int i = i1+1; i < i2; i++) s += a[i];   cout < < "s = " < < s < < endl; } пример: -27.52 34.26 -1.18 -8.80 35.24 6.73 18.42 -34.25 -30.21 44.03s = -14.06

Популярно: Информатика