1)var
s, k, i, n: integer;
a: array[1..1000] of integer;
begin
Read(n);
s := 0;
k := 0;
for i := 1 to n do
begin
Read(a[i]);
if (a[i] > 0) and (a[i] mod 8 = 0) then begin
s := s + a[i];
k := k + 1;
end;
end;
Write((s / k):0:3);
end.
1.1)
//pascalABC.Net 3.1 1200
//более краткий и наглядный вариант
begin
write(
ReadArrInteger(ReadInteger('n = '))
.Where(x -> (x > 0) and (x mod 8 = 0))
.Average);
end.
2)var
s, k, i, n: integer;
a: array[1..1000] of integer;
begin
Read(n);
s := 0;
k := 0;
for i := 1 to n do
begin
Read(a[i]);
if (a[i] < 0) and (a[i] mod 6 = 0) then begin
s := s + a[i];
k := k + 1;
end;
end;
Write((s / k):0:3);
end.
2.1)
//pascalABC.Net 3.1 1200
//более краткий и наглядный вариант
begin
write(
ReadArrInteger(ReadInteger('n = '))
.Where(x -> (x < 0) and (x mod 6 = 0))
.Average);
end.
3)var
s, i, n: integer;
a: array[1..1000] of integer;
begin
Read(n);
s := 0;
for i := 1 to n do
begin
Read(a[i]);
if (a[i] >= 5) and (a[i] <= 25) and (a[i] mod 2 = 0) then begin<br> s := s + a[i];
end;
end;
Write(s);
end.
3.1)
//pascalABC.Net 3.1 1200
//более краткий и наглядный вариант
begin
write(
ReadArrInteger(ReadInteger('n = '))
.Where(x -> (x >= 5) and (x <= 25) and (x mod 2 = 0))<br> .Sum);
end.