// PascalABC.NET 3.3.5, сборка 1662 (29.04.2018)
begin
Println($'Среднее арифметическое : {ArrRandomInteger(40,0,20).Println.Where(e-> e.IsOdd).DefaultIfEmpty.Average}')
end.
// FreePascal
var
a: array[0..39] of integer;
i, c, s: integer;
begin
randomize;
for i := 0 to 39 do
begin
a[i] := random(21);
Write(a[i],' ');
if (a[i] mod 2 <>0) then
begin
inc(c);
s := s + a[i];
end;
end;
Writeln;
if c<>0
then Writeln('Среднее арифметическое: ',s/c)
else Writeln(0);
end.
// C++
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
setlocale(LC_ALL, "Russian");
int a[40];
double c = 0, s = 0;
srand(time(0));
for (int i = 0; i < 40; i++) {
a[i] = rand() % 21;
cout << a[i] << " ";
if (a[i] % 2 != 0) {
c++;
s += a[i];
}
}
if (c!=0) cout << "\nСреднее арифметическое = " << s / c << endl;
else cout << "\nСреднее арифметическое = 0 " << endl;
system("pause");
return 0;
}
var
a: array[1..12] of real;
x: integer;
begin
Writeln('Начальный массив:');
for x:=1 to 12 do
begin
a[x]:=5*x-2;
writeln('a[', x, ']=', a[x]);
end;
Writeln('Увеличим каждый элемент массива на 8,125:');
for x:=1 to 12 do
begin
a[x]:=a[x]+8.125;
writeln('a[', x, ']=', a[x]);
end;
end.
Я поняла так :
Кит
Кис
Кум
Куст
Киса
Кира
Кипеть
Кипарис
По возрастанию . (может и не правильно , я не уверена , но я поняла так)
Var
A,B,C,D:integer;
Begin
Write('Введите четыре целых числа: ');ReadLn(A,B,C,D);
if A < B then A:=B;
if A < C then A:=C;
if A < D then A:=D;
WriteLn('Max = ',A);
End.
Var t, a, i: integer;
begin
write('Введите количество минут: ');
read(t);
a:=1;
for i:=1 to t do
begin
a:=a*2;
writeln('Бактерий через ', i , ' минут: ', a);
end;
<span>end.</span>