1)
var a: array [1..10] of integer;
i, m: integer;
begin
for i := 1 to 10 do
begin
a[i] := random(20);
writeln('[', i, '] => ', a[i]);
if (a[i] mod 2 = 0) then m := m + a[i];
end;
writeln(m);
end.
2)
var a: array [1..10] of integer;
i, m: integer;
begin
m := 1;
for i := 1 to 10 do
begin
a[i] := random(20);
writeln('[', i, '] => ', a[i]);
if (a[i] mod 2 = 1) then m := m * a[i];
end;
writeln(m);
end.
3)
var a: array [1..10] of integer;
i, m: integer;
begin
m := 1;
for i := 1 to 10 do
begin
a[i] := random(20);
writeln('[', i, '] => ', a[i]);
m := m + a[i];
end;
writeln(m / 10);
end.
4)
var a: array [1..10] of integer;
i, m, c: integer;
begin
m := 1;
for i := 1 to 10 do
begin
a[i] := random(20);
writeln('[', i, '] => ', a[i]);
if (a[i] mod 2 = 0) then
begin
m := m + a[i];
c := c + 1;
end;
end;
if (c > 0) then writeln(m / c);
end.
Прошу Вас =)