writeln('Indexi elementov kotorie bolshe prediduschego:');
writeln;
for i:=2 to 10 do begin
if a[i]>a[i-1] then write(i,', ');
end;
for i:=2 to 10 do begin
if ((a[i]>=0) and (a[i-1]>=0)) or ((a[i]<0) and (a[i-1]<0)) then p:=p+1;
end;
writeln;
if p>0 then writeln('Masiv imeet pari sosednih elementov s odnakovimi znakami') else writeln('Masiv ne imeet pari sosednih elementov s odnakovimi znakami');
var i,s,p:integer; a:array [1..100] of integer;
begin
s:=0; p:=0;
writeln('Vvedite masiv a:');
for i:=1 to 10 do begin
write('a[',i,']=');
readln(a[i]);
end;
for i:=1 to 10 do begin
if a[i]>0 then s:=s+a[i];
end;
s:=s*2;
writeln('Udvoennaya suma polozhitelnih elementov=',s);
writeln('Indexi elementov kotorie bolshe prediduschego:');
writeln;
for i:=2 to 10 do begin
if a[i]>a[i-1] then write(i,', ');
end;
for i:=2 to 10 do begin
if ((a[i]>=0) and (a[i-1]>=0)) or ((a[i]<0) and (a[i-1]<0)) then p:=p+1;
end;
writeln;
if p>0 then writeln('Masiv imeet pari sosednih elementov s odnakovimi znakami') else writeln('Masiv ne imeet pari sosednih elementov s odnakovimi znakami');
readln(s);
end.
1)
var
a,b:array [1..100] of integer;
i,j,k,a,b,f:integer;
begin
randomize;
readln(a);
readln(b);
k:=0;
for i:=1 to 20 do
begin
a[i]:=random(135)-45;
f:=0;
for j:=a to b do
if (a[i]=j) and (a[i] mod 7 =0) then f:=1;
if f=0 then
begin
k:=k+1;
b[k]:=a[i];
end;
end;
for i:=1 to k do
writeln(b[i]);
end.
2)
var
a,b:array [1..100] of integer;
i,j,k:integer;
begin
randomize;
readln(k);
j:=0;
for i:=1 to 20 do
begin
a[i]:=random(135)-45;
writeln(a[i]);
for i:=1 to 19 do
begin
if a[i]*a[i+1]>0 then
begin
j:=j+1;
b[j]:=a[i];
j:=j+1;
b[j]:=k;
end
else
begin
j:=j+1;
b[j]:=a[i];
end;
end;
j:=j+1;
b[j]:=a[20];
for i:=1 to j do
writeln(b[j]);
3)
var
a,b:array [1..20] of integer;
i,j,k1,k2:integer;
begin
randomize;
readln(k1);
readln(k2);
if k1<k2 then
begin
for i:=1 to 20 do
begin
a[i]:=random(135)-45;
writeln(a[i]);
end;
for i:=1 to k1-1 do
b[i]:=a[i];
for i:=k2+1 to 20 do
b[i]:=a[i];
j:=k2;
for i:=k1 to k2 do
begin
b[j]:=a[i];
j:=j-1;
end;
for i:=1 to 20 do
writeln(b[i]);
end;
end.