Const n=10;
var a:array[1..n] of integer;
i,s:integer;
begin
Randomize;
for i:=1 to n do
begin
a[i]:=random(361)+40;
write(a[i]:5);
end;
writeln;
s:=0;
for i:=1 to n do
if a[i] mod 5 = 0 then s:=s+a[i];
writeln('s = ',s);
end.
Пример:
346 213 87 382 165 184 278 261 124 233
s = 165