const n=20;
var a:array[1..n] of integer;
i,j,s:integer;
begin
a[1]:=25;
for i:=2 to n do
a[i]:=a[i-1]+2;
for i:=1 to n do write(a[i]:4);
writeln;
s:=0;
for i:=1 to n do
if i mod 2=0 then s:=s+a[i];
writeln('s = ',s);
end.
Результат:
25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63
s = 450
const n=20;
var a:array[1..n] of integer;
i,j,s:integer;
begin
a[1]:=25;
for i:=2 to n do
a[i]:=a[i-1]+2;
for i:=1 to n do write(a[i]:4);
writeln;
s:=0;
for i:=1 to n do
if i mod 2=0 then s:=s+a[i];
writeln('s = ',s);
end.
Результат:
25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 61 63
s = 450