program SumOfPositiveEvenElements;
varA: array[1..20] of Integer;N, i, sum: Integer;
beginwriteln('Enter the number of elements (N <= 20): ');readln(N);
if (N > 20) thenbeginwriteln('Error: N should be less than or equal to 20.');exit;end;
for i := 1 to N doA[i] := random(201) - 100;
sum := 0;
for i := 1 to N dobeginif (A[i] > 0) and (A[i] mod 2 = 0) thensum := sum + A[i];end;
writeln('Array A:');
for i := 1 to N dowrite(A[i], ' ');
writeln;
writeln('Sum of all positive even elements: ', sum);end.
program SumOfPositiveEvenElements;
var
A: array[1..20] of Integer;
N, i, sum: Integer;
begin
writeln('Enter the number of elements (N <= 20): ');
readln(N);
if (N > 20) then
begin
writeln('Error: N should be less than or equal to 20.');
exit;
end;
for i := 1 to N do
A[i] := random(201) - 100;
sum := 0;
for i := 1 to N do
begin
if (A[i] > 0) and (A[i] mod 2 = 0) then
sum := sum + A[i];
end;
writeln('Array A:');
for i := 1 to N do
write(A[i], ' ');
writeln;
writeln('Sum of all positive even elements: ', sum);
end.