, ,
, -- . , . , , , . , . . 11 12.
, , , , , , , .
11.1.
, , , .
:
1. , ;
2. , , ;
3. ( x) x:=x+d;, d -- .
0 π 0.25. x, x y. :
var x,y:real;
begin
writeln('x':10,'sin(x)':10);
{ }
x:=0; { }
while x<=pi6 do begin
y:=sin(x); { }
writeln (x:10:2, y:10:2);
{ }
x:=x+0.25; { x}
end;
end.
"" , . , , :
, a, b .
, .
var x,f,a,b,dx:real;
n:integer; { }
begin
repeat {
: a,dx,b
, dx>0, a+dx b}
writeln (' a,dx,b:');
{$I-}read (a,dx,b);{$I+}
if IoResult <> 0 then begin
writeln (' 3 ',
', ');
continue;
end;
if (dx<=0) or (a+dx>=b) then begin
writeln (' ',
', ');
continue;
end
else break;
until false;
{ }
writeln;
writeln ('x':10,'f(x)':10);
x:=a;
n:=2; {2 }
while x<=b6 do begin
{
real!}
if x<=0 then f:=sqr(x)*x
else f:=exp(1/3*ln(abs(x)));
{ 3 exp ln}
writeln (x:10:2,f:10:2);
n:=n+1;
if n=24 then begin
{ 25 }
write (' Enter...');
reset (input); readln;
n:=1;
end;
x:=x+dx;
end;
writeln (' ');
reset (input); readln;
end.
, -- , . 25 , n Enter.
, . .
. 1, 2, ..., K , K .
-- , for:
var t:real;
i,k:integer;
begin
writeln;
writeln (' :');
read (t);
writeln (' :');
read (k);
writeln ('':10,'':10);
for i:=1 to k do
writeln (i:10,(i*t):10:2);
end.
. t, i for. for 1, writeln , , .
11.2.
, , - . :
1. var , ;
2. 0;
3. , , 1 k:=k+1;.
2 , var . " , " -- ! , , , k:=0;.
, "" ( ) () :
Inc(X,N); -- .
X -- , N -- . X 1, N , N, N , Inc(X); X:=X+1;, Inc(X,N); X:=X+N;.
Dec(X,N); -- .
X -- , N -- . X 1, N , N, N , Dec(X); X:=X-1;, Dec(X,N); X:=X-N;.
Inc Dec , . , , .
.
z(i) , i=1,2,...,100. , 0.5.
k, :
var z:real;
i,k:integer;
begin
k:=0;
for i:=1 to 100 do begin
if i mod 2 = 0 then z:=sqr(i)*cos(i)
else z:=sin(i/2);
if z>0.5 then inc(k);
end;
writeln ('=',k);
end.
i 1, for, , i , mod.
.
n , 2≤n≤25. :
, , k1 -- "", "" "", k2 -- "" "".
a, for i (" "), . n a .
var a,i,n,k1,k2:integer;
ykol,ykach:real;
begin
writeln;
writeln (' :');
read (n);
k1:=0;
k2:=0;
for i:=1 to n do begin
write (' ',i,' :');
read (a);
if a>2 then begin
inc(k1);
if a>3 then inc(k2);
end;
end;
ykol:=k1/n*100;
ykach:=k2/n*100;
writeln
(' =',ykol:6:2);
writeln
(' =',ykach:6:2);
reset (input); readln;
end.
11.3.
, . :
1. , ;
2. - 0, -- 1;
3. , t , s:=s+t;, -- p:=p*t;
, -- 1, 0. p:=0; p:=p*t;, , .
. , .
s k . :
var x,f,s,p:real;
k:integer;
begin
s:=0; k:=0; p:=1;
x:=-5;
while x<=56 do begin
if x<0 then f:=sqr(ln(abs(x)))
else if x>0 then f:=sin(sqr(x))
else f:=0;
if f>0 then begin
s:=s+f;
k:=k+1;
end;
if f<>0 then p:=p*f;
x:=x+0.5;
end;
s:=s/k; { s - }
writeln
(' =',s:10:6);
writeln
(' =',p:10:6);
reset (input); readln;
end.
.
, : 0 , . : , -- 10000 .; 5%, -- 10000 20000 .; 7%, -- 20000 . .
s, -- t, :
var s,t:real;
begin
writeln;
s:=0; { !}
repeat
writeln (' '
'0 :');
{$I-}read(t);{$I+}
if (IoResult<>0) or (t<0) then begin
writeln ('! ');
continue;
end;
if t=0 then break;
{ t 2 -
, }
t:=round (t*100) / 100;
s:=s+t; { }
until false;
{ }
writeln (' :',s:8:2);
if s>20000 then s:=s-s*0.07
else if s>10000 then s:=s-s*0.05;
writeln (' :',s:8:2);
writeln (' !');
reset (input); readln;
end.
real s t -- integer . , , .