1
3
1. E[1:n]. .
Var
n,i,j,k,l,imin,kol,per:integer;
a,s,c,z,e: array [1..20] of integer;
min:real;
Begin
n:=0;
Writeln(' ');
Writeln(' <=20');
readln(n);
writeln(' - ');
for i:=1 to n do begin
writeln('e[',i,']=');
read(e[i]);
end;
writeln(' ');
for i:=1 to n do
write (e[i]:7);
i:=1;
While (i<=n) and (e[i] mod 2 <> 0) do
i:=i+1;
If i<=n then
j:=i
else Writeln(' ');
i:=n;
While (i>=1) and (e[i] mod 2 = 0) do
i:=i-1;
If i>=1 then
k:=i
else writeln(' ');
Per:=e[k];
e[k]:=e[j];
e[j]:=per;
writeln;
Writeln(' , ');
For i:=1 to n do
Write (e[i]:7);
end.
2. F[1:n]. : , , .
Var
n,i,j,k,l,value:integer;
a,s,B,f: array [1..20] of integer;
Begin
Writeln(' 2 , , , ');
Writeln(' <=20');
readln(n);
writeln(' - ');
for i:=1 to n do
readln(f[i]);
writeln(' ');
for i:=1 to n do
write (f[i]:7);
Writeln;
Writeln(' value');
Readln(value);
j:=0;
l:=0;
For i:=1 to n do
If (f[i]<=value) then
Begin
j:=j+1;
a[j]:=f[i];
end;
Ifj<>0 then
Begin
Writeln;
Writeln(' [',j,'] f[',n,'], value: ');
For i:=1 to j do
Write(a[i]:8);
End
Else
Writeln(' A[',n,'] , value. .');
For i:=1 to n do
If(f[i]>value) then
Begin
l:=l+1;
b[l]:=f[i];
end;
Ifl<>0 then
Begin
Writeln;
Writeln(' B[',l,'] f[',n,'], value: ');
For i:=1 to l do
Write(b[i]:8)
End
Else
Writeln(' B[',n,'] , value. .');
end.
3.
4
1
4
1. A[1:n]. .
var I,N,max,min:integer;
A:Array[1..20] of integer;
begin
writeln(' ');
readln(N);
for I:=1 to N do
begin
writeln(' ',I,'- ');
readln(A[I]);
end;
writeln(' :');
for I:=1 to n do
|
|
write(A[I],',');
writeln;
min:= a[1];
max:=a[1];
for i:= 1 to n do
If (a[i] mod 2 <>0) and (a[i]<min) then
min:=i;
a[min]:=0;
for i:= n downto 1 do
If (a[i] mod 2 <>0) and (a[i]>max) then
max:=i;
a[max]:=0;
Writeln(' ');
For i:=1 to n do
write(a[i],',');
end.
2. H[1:n]. : , .
var nb1,nb2,n,i,s:integer;
B:array[1..20] of integer;
A:array[1..20] of integer;
C:array[1..20] of integer;
begin
writeln(' - , 20');
readln(n);
writeln(' - ');
for i:=1 to n do
readln(B[i]);
writeln(' ');
for i:=1 to n do
write(B[i],',');
writeln;
nb1:=0;
nb2:=0;
for i:=1 to n do
begin
if (B[i]>0) and (b[i] mod 2=0) then
begin
nb1:=nb1+1;
A[nb1]:=B[i];
end;
if (B[i]<=0) or ((b[i]>0) and (b[i] mod 2<>0)) then
begin
nb2:=nb2+1;
C[nb2]:=B[i];
end;
end;
for i:=1 to nb1 do
write(' ');
write(A[i],',');
writeln;
for i:=1 to nb2 do
write(' ');
write(C[i],',');
writeln;
end.
3.
Var
I: integer;
Ch,Zn,Summa,S1,S2,x,eps: real;
Begin
Write('X=');
Readln(X);
Writeln;
Write('Eps=');
Readln(Eps);
Writeln;
I:=1; { }
Ch:=1;{ }
Zn:=1;{ }
Summa:= 0;{ }
S2:=0;{ i- }
S1:= ch/zn;{ i-1 - }
repeat
S2:= S1;
Summa:= Summa + S2;
Ch:=ch*(-(x-1));
Zn:= Zn+1;
S1:= ch/zn;
Writeln('S1=', Ch,'/',Zn);
I:=I+1;
Writeln(' ', S1:6:2);
Writeln('IS1-S2I',Abs(S1-S2):10:4);
Until Abs(S1-S2)<=Eps;
Writeln(' ',Summa);
End.
1
5
1. B[1:n]. .
var a: array [1..20] of integer;
n,i,imin,imax,nmin,nmax: byte;
buf: integer;
begin
writeln(' ');
readln(N);
for I:=1 to N do
begin
writeln(' ',I,'- ');
readln(A[I]);
end;
writeln(' :');
for I:=1 to n do
write(A[I],',');
writeln;
for i:=1 to n do
begin
if a[i]>0 then
begin
if nmin=0 then
begin
inc(nmin);
imin:=i;
end else if a[i]<a[imin] then imin:=i;
end;
if a[i]<0 then
begin
if nmax=0 then
begin
inc(nmax);
imax:=i;
end else if a[i]>a[imax] then imax:=i;
end;
end;
writeln;
writeln(' =',a[imin],' ',imin);
writeln(' =',a[imax],' ',imax);
buf:=a[imin];
a[imin]:=a[imax];
a[imax]:=buf;
writeln(' ');
for i:=1 to n do
write(a[i]:4);
end.
2. A[1:n]. .
Var
N: Integer;
A: array[1.. 20] of Integer;
Kol: Integer;
I, J: Integer;
Begin
Writeln (' <=20 ');
Readln(N);
Writeln (' ');
|
|
For I:=1 to N do
Readln(A[I]);
Writeln (' ', N:3, '');
For i:=1 to N do
Write (A[i]:4);
Writeln;
Kol:=0;
For I:=N downto 1 do
If (A[I] mod 3=0) and (a[i]>0) Then
Begin
For J:= I to N-1 do
A[J]:=A[J+1];
Kol:=Kol+1;
End;
N:=N-Kol;
Writeln(' ',N:3,'');
For I:=1 to N do
Write (A[I]:4);
End.
3.
Var
I: integer;
Ch,Zn,Summa,S1,S2,x,eps: real;
Begin
Write('X=');
Readln(X);
Writeln;
Write('Eps=');
Readln(Eps);
Writeln;
I:=0; { }
Ch:=1;{ }
Zn:=x;{ }
Summa:= 0;{ }
S2:=0;{ i- }
S1:= ch/zn;{ i-1 - }
repeat
S2:= S1;
Summa:= Summa + S2;
Ch:=ch;
Zn:= Zn*power(x,2)*(3+i);
S1:= ch/zn;
Writeln('S1=', Ch,'/',Zn);
I:=I+2;
Writeln(' ', S1:6:2);
Writeln('IS1-S2I',Abs(S1-S2):10:4);
Until Abs(S1-S2)<=Eps;
Writeln(' ',Summa);
End.
1
6
1. X[1:n]. .
Var
N, Min, I: Integer;
X: array [1.. 20] of Integer;
Begin
Writeln(' ');
Writeln(' N <= 20');
Readln (N);
Writeln(' - ');
For I:= 1 to N do
Readln (X [I]);
Writeln(' ');
For I:= 1 to N do
Write (X [I]: 3);
Writeln;
Min:= X [1];
For I:= 2 to N do
IfX [I] < Min Then
Min:= X [I];
For I:= 1 to N do
If X [I] = Min Then
X [I]:= 0;
Writeln(' ');
For I:= 1 to N do
Write (X [I]: 3);
End.
2. Y[1:n]. : , .
Var
N, Na, Nb, I: Integer;
Y: array [1.. 20] of Integer;
A: array [1.. 20] of Integer;
B: array [1.. 20] of Integer;
Begin
Writeln(' ');
Writeln(' N <= 20');
Readln (N);
Writeln(' - ');
For I:= 1 to N do
Readln (Y [I]);
Writeln(' ');
For I:= 1 to N do
Write (Y [I]: 3);
Writeln;
Na:= 0;
For I:= 1 to N do
Begin
If odd (Y [I])= False Then
Begin
Na:= Na + 1;
A [Na]:= Y [I]
end;
I:= I + 1
end;
IfNa > 0 Then
Begin
Writeln (' , , ');
For I:= 1 to Na do
Write (A [I]: 3);
Writeln;
End
Else
Writeln(' ');
Nb:= 0;
For I:= 2 to N do
Begin
If odd (Y [I])= True Then
Begin
Nb:= Nb + 1;
B [Nb]:= Y [I]
end;
I:= I + 1
end;
IfNb > 0 Then
Begin
Writeln (' , , ');
For I:= 1 to Na do
Write (B [I]: 3);
Writeln;
End
Else
Writeln(' ');
End.
3.
Var
I: integer;
Ch,Zn,Summa,S1,S2,x,eps: real;
Begin
Write('X=');
Readln(X);
Writeln;
Write('Eps=');
Readln(Eps);
Writeln;
I:=1; { }
Ch:=x;{ }
Zn:=1;{ }
Summa:= 0;{ }
S2:=0;{ i- }
S1:= ch/zn;{ i-1 - }
Repeat
S2:= S1;
Summa:= Summa + S2;
Ch:= Ch*(-x);
Zn:= Zn*(I + 1);
S1:= ch/zn;
Writeln('S1=', Ch,'/',Zn);
I:=I+1;
Writeln(' ', S1:6:2);
|
|
Writeln('IS1-S2I',Abs(S1-S2):10:4);
Until Abs(S1-S2)<=Eps;
Writeln(' ',Summa);
End.
1
7
Y[1:n]. , .
Var
N, Min, I, Kolvo: Integer;
Y: array [1.. 20] of Integer;
Begin
Writeln(' ');
Writeln(' N <= 20');
Readln (N);
Writeln(' - ');
For I:= 1 to N do
Readln (Y [I]);
Writeln(' ');
For I:= 1 to N do
Write (Y [I]: 3);
Writeln;
Min:= Y [1];
For I:= 2 to N do
IfY [I] < Min Then
Min:= Y [I];
Kolvo:= 0;
For I:= 1 to N do
IfY [I] <> Min Then
Kolvo:= Kolvo + 1;
IfKolvo > 0 Then
Writeln(' , =', Kolvo:3)
Else
Writeln(' ');
End.