Const n=10; var a:array[1..n] of integer; i,k:integer; begin Randomize; writeln('Массив A:'); for i:=1 to n do begin a[i]:=random(51); write(a[i]:4); end; writeln; k:=0; for i:=1 to n do if (a[i] mod 2=0)and(a[i] mod 7=0)and(i mod 2=0) then k:=k+1; writeln('k = ',k); end.
var a:array[1..n] of integer;
i,k:integer;
begin
Randomize;
writeln('Массив A:');
for i:=1 to n do
begin
a[i]:=random(51);
write(a[i]:4);
end;
writeln;
k:=0;
for i:=1 to n do
if (a[i] mod 2=0)and(a[i] mod 7=0)and(i mod 2=0) then k:=k+1;
writeln('k = ',k);
end.
Пример:
Массив A:
25 29 13 39 9 14 27 16 12 45
k = 1