Program n1; const n=20; var a: array[1..n] of integer; i,sum: integer; begin randomize; sum:=0; write('mas: '); for i:=1 to n do begin a[i]:=random(41)-20; write(a[i],' '); if (i mod 2=0) and (a[i] mod 2<>0) then sum:=sum+a[i]; end; writeln; write('sum=',sum); end.
const n=20;
var a: array[1..n] of integer;
i,sum: integer;
begin
randomize;
sum:=0;
write('mas: ');
for i:=1 to n do
begin
a[i]:=random(41)-20;
write(a[i],' ');
if (i mod 2=0) and (a[i] mod 2<>0)
then sum:=sum+a[i];
end;
writeln;
write('sum=',sum);
end.