1)
const n = 20;
var
a: array[1..n] of integer;
i, s: integer;
begin
for i := 1 to n do begin
a[i] := random(50);
write(a[i], ' ');
if(a[i] mod 7 = 0) then s := s + a[i];
end;
writeln;
writeln('Сумма эл., кратных 7: ', s);
end.
2)
const n = 8;
var
a: array[1..n] of integer;
i, s: integer;
begin
for i := 1 to n do begin
a[i] := random(50);
write(a[i], ' ');
if(a[i] mod 2 <> 0) then s := s + a[i];
end;
writeln;
writeln('Сумма нечетных эл: ', s);
end.
3)
const n = 10;
var
a: array[1..n] of integer;
i, s, count: integer;
begin
for i := 1 to n do begin
a[i] := random(50);
write(a[i], ' ');
if(i mod 2 = 0) then begin
s := s + a[i];
inc(count);
end;
end;
writeln;
writeln('Ср. арифметическое эл. с четными номерами: ', s / count);
end.