Const n=7;
var a: array[1..n] of integer;
i: integer;
begin
writeln('Исходный массив:');
for i:=1 to n do begin
write('a[',i,']=');
readln(a[i]);
end;
writeln;
writeln('1)');
for i:=1 to n do
if a[i]>0 then write(a[i],' ');
writeln;
writeln('2)');
for i:=1 to n do
if a[i] mod 2 <> 0 then write(a[i],' ');
writeln;
writeln('3)');
for i:=1 to n do
if (a[i]>0)and(a[i] mod 5 = 0) then write(a[i],' ');
writeln;
writeln('4)');
for i:=1 to n do
if i mod 2 = 0 then write(a[i],' ');
writeln;
writeln('5)');
for i:=1 to n do
if i mod 3 = 0 then write(a[i],' ');
writeln;
end.
Пример:
a[1]=15
a[2]=-48
a[3]=29
a[4]=-51
a[5]=94
a[6]=30
a[7]=67
1)
15 29 94 30 67
2)
15 29 -51 67
3)
15 30
4)
-48 -51 30
5)
29 30