Написать программу нахождения среднего арифметического минимального и первого элементов массива r(10). найдите количество элементов в массиве е(25), абсолютная величина которых больше 8. найти сумму элементов массива а(10) удовлетворяющих условию а(х)< 10.
using namespace std;
int main()
{
double a, b, c;
cout << "A = ";
cin >> a;
cout << "B = ";
cin >> b;
cout << "C = ";
cin >> c;
if (a <= b)
if (b<c)
cout << "rez = " << a*b << endl;
else cout << "rez = " << a*c << endl;
else
if (b >= c)
cout << "rez = " << c*b << endl;
else if (c>a) cout << "rez = " << a*b << endl;
else cout << "rez = " << c*b << endl;
cout << endl;
system("pause");
return 0;
}
n=10;
var
a:array[1..n] of integer;
i,_start,_end, startInd, endInd:integer;
begin
Randomize;
Write('Исходный массив: ');
_start:=-1; _end:=-1;
startInd:=-1; endInd:=-1;
for i:=1 to n do
begin
a[i]:=random (0,100);
Write(a[i],' ');
end;
Writeln;
for i:=2 to n do
begin
if a[i]>a[i-1] then
if _start > -1 then _end := i else
begin
_start := i-1;
_end := i;
end
else
begin
if (_start > -1) and ((endInd - startInd) < (_end - _start)) then
begin
startInd := _start;
endInd := _end;
end;
_start := -1;
_end := -1;
end;
end;
if startInd > -1 then
begin
Writeln('Длина диапазона: ', (endInd-startInd+1));
Write('Значения из диапазона: ');
for i:=startInd to endInd do Write(a[i],' ');
end;
end.