Uses crt;
var
a: array [1..20] of integer;
k,s,i:integer;
begin
writeln;
for i:= 1 to 15 do readln(a[i]);
for i:= 1 to 15 do write(a[i],' ');
writeln;
for i:= 1 to 15 do
if a[i] mod 2 = 0 then
begin
S:=S+a[i];
k:=k+1;
end;
writeln('S = ',s,' k = ',k);
end.
Пример:
14
54
87
20
75
12
67
84
35
11
51
34
80
56
87
14 54 87 20 75 12 67 84 35 11 51 34 80 56 87
S = 354 k = 8