program SumAndCountMultiplesOfThree;vararr: array[1..10] of integer;i, count, sum: integer;begincount := 0;sum := 0;
randomize;
for i := 1 to 10 dobeginarr[i] := random(31) - 20;writeln('Element ', i, ': ', arr[i]);
end;
writeln('Number of elements divisible by 3: ', count);writeln('Sum of elements divisible by 3: ', sum);end.
program SumAndCountMultiplesOfThree;
var
arr: array[1..10] of integer;
i, count, sum: integer;
begin
count := 0;
sum := 0;
randomize;
for i := 1 to 10 do
if arr[i] mod 3 = 0 thenbegin
arr[i] := random(31) - 20;
writeln('Element ', i, ': ', arr[i]);
begin
count := count + 1;
sum := sum + arr[i];
end;
end;
writeln('Number of elements divisible by 3: ', count);
writeln('Sum of elements divisible by 3: ', sum);
end.