xn | exp(n*ln(x)) |
log b a | ln(a)/ln(b) |
tg x | sin(x)/cos(x) |
ctg x | cos(x)/sin(x) |
READLN | c | Readln(1, , N) |
WRITELN | c | Writeln('') Writeln(1,..., N) |
READ | Read(1, , N) | |
WRITE | Write('') Write(1,..,N) | |
IF THEN | if <> then <1> else <2> if <> then <> | |
CASE | case <> of < 1>: < 1>; < n>: < n> [else <>] end; |
1.
Z = | cos 4 3 tg 2 |+ 0.8 sin y2+ 10 .
: = = z=
: x, y -, z
Program pr1;
Var x,y,z: real;
Begin
writeln(' X, Y'); { }
readln (x,y); { x y}
z:=abs(cos(sqr(x)*sqr(x)-3*sin(sqr(x))/cos(sqr(x))))+0.8*sin(y*sqr(x))+10;
writeln(' x=',x:8:2,' y=',y:8:2,' z=',z:8:2); { }
readln; { Enter}
End.
X, Y
1 2
x=1.00 y=2.00 z=11.59
2.
. , , 7 .
: , b, c, d
Program pr2;
Var a,b,c,d:real;
Begin
write(' a= '); readln (a); { }
b:=a+a; {2a}
c:=b+b; {4a}
d:=b+c; {6a}
a:=d+a; {7a}
writeln('7a=',a:8:2); { }
readln; { Enter}
End.
a= 2
7= 14.00
3.
4- , 2 3 .
Program pr3;
Var n,a,b,c,d:integer;
Begin
write(' n '); readln (n); { 4- }
a:=n div 1000; {1- }
b:=n div 100 mod 10; {2- }
c:=n div 10 mod 10; {3- }
d:=n mod 10; {4- }
n:= a*1000+c*100+b*10+d; { }
writeln(' ', n); { }
readln; { Enter}
End.
:
n 1234
1324
4.
x y.
Program pr4;
Var x,y,t: integer;
begin
write(' x, y '); { }
readln(x,y); { }
t:=x; { t }
x:=y;
y:=t;
writeln('x=', x, 'y=',y); { }
|
|
readln; { Enter}
end.
:
x, y 3 7
x=7 y=3
5.
.
Program pr5;
Var a, b, c, m: integer;
BEGIN
Write('a, b, c='); readln(a, b, c); { }
if a<b then m:=a else m:=b; { a b}
if c<m then m:=c; { }
writeln('in=', m); { }
readln
END.
:
1 :
a, b, c= 15 6 9
in=6
2 :
a, b, c= 1 45 4
in=1
3 :
a, b, c= 25 16 9
in=9
6.
Ax2 + Bx + C = 0.
Program pr6;
Var a, b, c, d, x1, x2: real;
Begin
Write('a, b, c='); readln(a, b, c); { }
d:=sqr(b)-4*a*c; { }
if d>0 then begin { , }
x1:=(-b+sqrt(d))/(2*a); writeln('x1=', x1:6:2);
x2:=(-b-sqrt(d))/(2*a); writeln('x2=', x2:6:2) end
else if d=0 then { , = 0, }
begin x1:=-b/(2*a); writeln('x=', x1:6:2) end
else writeln(' '); { }
readln
End.
:
1 :
a, b, c= 1 -2 1
x= 1.00
2 :
a, b, c= 1 -6 8
x1= 4.00
x2= 2.00
3 :
a, b, c= 5 1 2
7.
. .
, (x2+y2 <25) , , (x2+y2>4).
Program pr7;
Var x,y: real;
Begin
Write(' x y '); readln (x,y); { }
if (sqr(x)+sqr(y)<25) and (sqr(x)+sqr(y)>4)
then writeln(' ')
else writeln(' ');
readln;
End.
:
1 :
x y 1 1
2 :
x y 2 5
8.
.
Program pr8;
Var N: char;
Begin
Writeln (' '); Readln (N);
Case N of
'': writeln ('');
'': writeln ('');
'': writeln('');
'': writeln('')
End.
:
1.
Z = |3 +3 2 ln | + 1,82 + 1 . : = = z=
2.
Z = tg 3 |2 sin 2 + 7.8 cos |+ 10 . : = = z=
3.
Z = (4 2 ctg 22)/| 82 5 arctg | . : = = z=
4.
Z = tg 5 21 ctg 2 /(18 sin 13 cos + 11) . : = = z=
5.
Z = (2e-4 |sin 2|)/(2.1ctg 2 + 10.2) . : = = z=
|
|
6. . , , a4 .
7. . , , a6 .
8. . , , a7 .
9. . , , a8 .
10. . , , a9 .
11. . , , a10 .
12. . , , 6a .
13. 4- .
14. 4- .
15. 3- .
16. 3- . .
17. 3- .
18. 4- , 1 4 .
19. 3- .
20. 3- . 1- 3- .
21. 4- , 1-3 2-4 .
22. 4- .
23. 3- .
24. 4- , 1 3 .
25. 4- , 3 4 .
26. . .
26. . 7?
27. . .
28. . 5, .
29. . , .
30. . , 3-.
31. Y. , . .
32. Y. Y, .
33. A, B, C, D .
34. . , .
35. . , 10 .
36. X Y. .
37. , (-10, 15)?
38. . , , 10.
39. X Y. .
40. A, B, C, D .
41. , A, B, C, D .
42. , (, , , , , , ).
43. , .
44. , .
45. , : , , , .
46. , :
A - Abs x
S - Sin x
C - Cos x
47. . .
|
|
|
|
| |||
| |||
|
II.
:
For | For <>:=< > to <.> do <>; 1. For <>:=<. > downto <. > do <>; -1 | |
While | While <> do <>; , . | |
Repeat Until | Repeat <>; Until <>; , . |
1.
.
Program pr1;
Var i, x: integer;
Begin
for i:=1 to 10 do begin { 1 10}
x:=sqr(i); { }
write(x, ' '); { }
end;
readln
End.
1 4 9 16 25 36 49 64 81 100
2.
1 + 1/3 + 1/5 +...(N ).
:
Program pr2;
Var I, N: integer; S: real;
Begin
Write('N='); Readln(N); { }
S:=0; { }
For I:=1 to N do { N }
S:=S+1/(2*I-1);
Writeln('S=',S:5:2); { }
Readln
End.
:
N=4
S= 1.68
3.
(1 + sin2)*(2 + sin3)*... (n ).
rogram Pr3;
Var n, i: integer; p: real;
Begin
write('n='); readln(n); p:=1;
for i:=1 to n do
p:=p* (i + sin(i+1));
writeln('p=', p:6:3);
readln
End.
:
n=5
p=131.645
4.
-21; - 16; .
a , n
Program Pr4;
Var
a, n: integer;
Begin
a:= -21; n:=1; { }
while a<=0 do begin { 0,}
a:=a+5; n:=n+1; { . }
end;
writeln(n=, n); { 1- }
readln;
End.
:
n=6
5.
y:=sin(x)*x [-p/2,p/2] p/10.
Program pr5;
Var x, y: real;
Begin
x:=-pi/2;
while x<=pi/2 do begin
y:=sin(x)*x; writeln('x=',x:8:2,' y=',y:8:2); x:=x+pi/10
end;
End.
6.
, .
Program Pr6;
Var n, a, b, k: integer;
Begin
k:=0; for n:=10 to 99 do begin
a:= n div 10; b:=n mod 10;
if (a+b) mod 2=1 then k:=k+1;
end;
writeln('k=',k)
end.
7
( ) m pr (1% pr=1).
Program Pr7;
Var pr,m,s,s0: real;
N: integer;
Begin
Repeat
Write ( :); readln(pr);
Write ( :); readln (m)
Until (m>1) and (pr>0); { }
N:=0; { }
s0:=1000; { }
s:=s0; { }
Repeat { }
s:=s*(1+pr/100); inc(N)
Until s/s0>=m;
WriteLn ( :,N);
|
|
ReadLn
End.
1. n. 21+22++2n.
2. n. n! ()
3. n. .
4. n . .
5. , n. .
6. : = (1 + )(3+2)(5+3).... (n )
7. . 7,6; 6,3; . , <0.
8. 2; 2,8; . , >20.
9. . 7,1; 5,3; . , <0.
10. . 8,4; 6,2 . , <0.
11. . 2; 3,8;.... , >30.
12. .
13. , 7.
14. , 3.
15. , 10.
16. , 3.
17. .
18. y=x3-1 [-1,3] 0.2.
19. y=x2-1/x [1,2] 0.05.
20. y= sin x cos x [-p,p] p/10.
21. y= cos(x)*x [-p,p] p/10.
22. y=sin2x [0,p] p/20.
23. y= cos x2+sin x2 [-p/2,p/2] p/10.
24. n. S=1-1/5+1/9-1/13+. (n )
25. n. S=1-3+5-. (n )
26. P . ., 3%. , Q? ?
27. P . Q , . , ?
28. . :
- (100010000),
- ( 1% 10% ),
- (0.5% 4% ).
, .
29. . :
- (200020000),
- (1% 3% ),
- ( 2% 7% ).
, , .
30. .
:
- (300030000),
- (1% 4% ),
- ( 3% 7% ),
- , ( 3 36).
, , 70 %.
31. . :
- (400020000),
- ( 4% 10% ),
- (0.4% 4%).
, .
32. . :
|
|
- (200020000),
- (1.5% 5%),
- ( 0.5% 5% ).
, , 50%.
33. .
:
- (1000100000),
- (1% 10%),
- ( 6% 10% ),
- , ( 6 24).
, , 60 %.
34. . :
- (50010000),
- ( 1% 10% ),
- (0.5% 4% ).
, .
35. . :
- (10020000),
- (1% 13% ),
- ( 2% 7% ).
, , .
III.
, . .
:
Procedure <_>(<>); -
Label <>;
Const <>; , , ,
Type < >; ( )
Var <>;
Begin
< > -
End;
, . . . . -. - , , . -. - Var.
:
Function <_>(<>): < >;
Label <>;
Const <>; , , ,
Type < >; ( )
Var <>;
Begin
<, >;
End;
, , : <_>:=<>.
1.
, !
Program pr1;
Function Fact(x: integer): real; { }
Var
i: integer; f: real;
begin
f:=1; for i:=1 to x do f:=f*i; { }
Fact:=f; { }
end;
Var
x: integer; y: real;
BEGIN { }
Write (x=); Readln(x); { }
y:=Fact(x); { }
Writeln(y=, y:4:0); { }
Readln;
END.
:
x= 4
y= 24
2.
. , ( ).
, x, y, z , p )
Program pr2;
Function PlTr(x,y, z: real): real; { }
Var
p: real;
Begin
p:= (x + y + z)/2; { }
PlTr:=Sqrt(p*(p-x)*(p-y)*(p-z));
End;
Var
a1, b1, 1, s1, a2, b2, 2, s2: real;
BEGIN { }
{ }
Write('C 1- :'); Readln(a1, b1, c1);
Write('C 2- :'); Readln(a2, b2, c2);
S1:=PlTr(a1, b1, c1); { 1- }
S2:=PlTr(a2, b2, c2); { 2- }
if S1>S2 then Writeln(S1>S2) else
if S1<S2 then Writeln(S1<S2) else Writeln(S1=S2);
Readln;
END.
:
C 1- :3 4 5
C 1- :6 7 8
S1<S2
3.
xn, x,n
, <0 .
Program Pr3;
Function stepen(x,n:integer):real; { }
begin
if (n mod 2 <> 0) and (x<0) then stepen:=-exp(n*ln(abs(x)))
else stepen:=exp(n*ln(abs(x)));
end;
Var
x,n:integer;
BEGIN
write('x,n='); readln(x,n); { }
write('stepen=',stepen(x,n):6:2); { }
readln;
END.
:
1
x,n=2 3
stepen= 8.00
2
x,n=-2 3
stepen= -8.00
3
x,n=2 -2
stepen= 0.25
4
x,n=-2 -2
stepen= 0.25
4.
, :
(n )
Program pr4;
Function Fakt(x: integer): real; { }
Var
i: integer; f: real;
begin
f:=1; for i:=1 to x do f:=f*i;
Fakt:=f;
end;
Var s: real; i, n: integer;
Begin
write('n= '); Readln(n); { }
s:=0;
For i:=1 to n do { i 1 n}
s:=s+i/Fakt(i+1); { , }
{ }
writeln('s=',s:6:4); { }
Readln;
end.
:
n=3
s=0.9583
5.
a, b.
Program pr5;
Procedure Treug(a,b: real; Var p, s: real); { }
{a, b- (-), p, s- (-)}
Begin
p:= a + b + Sgrt(a*a + b*b); { a, b}
s:= a*b/2; { a, b }
End;
Var
a, b, p, s: real; { a, b- , p - , s - }
BEGIN { }
Write('a, b =');Readln(a, b); { }
Treug(a, b, p, s); { a, b}
Writeln('p=', p:4:1, s=, s:4:1); { , }
Readln;
END.
:
a, b= 3 4
p=12.0 s= 6.0
6.
, x, y, z. a,b,c,d , .
: .
Program pr6;
Procedure Treug(x, y, z: integer); { }
Begin
if (x<y+z) and (y<x+z) and (z<x+y)
then writeln( , x, ,, y, ,, z, )
else writeln( , x, ,, y, ,, z, )
End;
Var
a,b,c,d: integer;
BEGIN { }
Write(' a b c d: '); Readln(a,b,c,d); { }
Treug(a,b,c); { a,b,c}
Treug(a,b,d);); { a,b,d}
Treug(a,c,d);); { a,c,d}
Treug(b,c,d);); { b,c,d}
Readln;
END.
:
a b c d: 1 3 4 5
1,3,4
1,3,5
1,4,5
3,4,5
7.
A, B, C, 2- .
Program pr7;
Procedure Obmen(Var X,Y:real); {X,Y - , }
Var
T: real; { T }
Begin
T:=X;
X:=Y;
Y:=T;
End;
Var
A, B, C: real;
BEGIN { }
Write('A, B, C ='); Readln(A,B,C); { }
If A>B then Obmen(A,B); { A B, }
If A>C then Obmen(A,C); { A , }
If B>C then Obmen(B,C); { , }
Writeln('A=', A:5:2,' B=', B:5:2,' C=', C:5:2); { }
Readln;
END.
:
A, B, C = 6 18 3
A= 3.00 B= 6.00 C= 18.00
8.
N , d. 7 2, 5, (a=2, d=3) 10 20, 19, .(a=20, d= -1)
Program pr8;
Procedure progres(a,d,n:integer); { }
Var
i: integer; {i }
Begin
for i:=1 to n do { i 1 n}
begin
write(a,' '); { }
a:=a+d; { }
end;
End;
BEGIN { }
progres(2,3,7); { 7 2, 5,}
writeln;
progres(20,-1,10); { 10 20,19,}
Readln;
END.
:
2 5 8 11 14 17 20
20 19 18 17 16 15 14 13 12 11
1. .
2. .
3. . (L= 2pR, S=pR2)
4. .
5. a,b,c.
6. A, B, C, D. A C, B D, 2- .
7. N , d. 8 1, 4, 10 24, 22, .
8. N , d. 5 3, 7, 7 14, 11, .
9. N , d. 7 12, 10, 9 2, 5, .
10. N , an=2n+1.
11. N , an=3n-2.
12. N , an=5n-3.
13. N , an=4n-1.
14. , -3 8 (x-5)(x+1)>0 ( , (x-5)(x+1)>0)
15. , -10 2 (x+4)(x+1)<0 ( , (x+4)(x+1)<0)
16. a b. : 1) 10 20; 2) -5 15.
17. y=sin 3x + 1 a b h. : ) 1 2 0.1 ) 5 10 0.5
18. y=tg x + 1/x a b h. : ) 2 4 0.2 ) 1 10 0.5
19. y= 3x2 + 1 a b h. : ) 1 2 0.1 ) 2 5 0.5
20. y=sin (x + 1)2 a b h. : ) 2 3 0.1 ) -2 3 0.5
21. A, B, C, .
22. A, B, C, D, 2- .
23. a/b (a, b ), .
24. A, B, C, .
25. . , ( ).
26. . , ( ).
27. . , ( ).
28. 2 . ( ).
29. 3 . ( ).
30. 3-2 + 42 +5-2, .
31. (-32 + 24)/4-2, .
32. (a! + b!)/(a+b)!, .
33. m! + (m+n)!, .
34. , :
(15 )
35. , :
... (n )
36. , :
(n .)
37. , :
(15 )
38. , :
... (n )
39. , :
(n .)
40. , :
(15 )
IV.
( ), , . . . . . array of ( ).
Type < >=array [< >] of < >;
Var <, >: < >;
type:
Var <>:array[< >] of < >;
:
Type
Vektor =array [1..7] of integer;
Massiv =array [1..20] of real;
Var
,B:vector; X: massiv;
:
Var , B: array [1..7] of integer;
X: array [1..20] of real;
A=B, A<>B, A:=B.
. . : X[10] - X 10.
. :
Var
A: Array[1..20] of Array [1..30] of Integer;
Var
A: Array [1..20,1..30] Of Integer;
, , 20 30 . . , , 5- 6- A[5,6].
1.
20 , , .
Program PR1;
Var
A: Array [1..20] Of Integer; I: Integer;
BEGIN
For I:=1 To 20 Do { }
Readln(A[I]); { }
For I:=20 Downto 1 Do { }
Write(A[I],' ')
END.
, . , 0 1, Random. 0 N Random(N+1). [a, b] Random(b-a+1)+a.
2.
20 10 100. .
Program pr2;
Var
A: Array [1..20] Of Integer; I, S: Integer;
BEGIN
S:=0; { }
For I:=1 To N Do begin
A[I]:= Random(101)-50; { }
Write(A[I],' '); { }
S:=S+A[I]; { }
end
END.
3.
10 . , 3 20 . .
Program pr3;
Var A:array[1..10] of integer;
i, n, m: integer; {m- , n- }
BEGIN
for i:=1 to 10 do begin { }
a[i]:=random(18)+3; write(a[i],' ');
end; writeln;
m:=a[1]; n:=1; { 1- }
for i:=2 to 10 do { , 2-}
if a[i]>m then begin m:=a[i]; n:=i end; { }
write('n=',n)
END.
4.
A B, 10 . (c ).
Program pr4;
Type massiv=array[1..10] of integer;
{, }
Procedure SumMas(Var z: massiv; Var Sz: integer);
Var
i: integer;
Begin
Sz:=0; for i:=1 to 4 do begin
z[i]:=random(20); write(z[i]:4);
Sz:=Sz+z[i];
end;
End;
Var
a, b:massiv;
S, Sb: integer; {S- , Sb b}
BEGIN { }
Write( A:); SumMas(a,Sa); writeln;
Writeln(C A =, Sa);
Write(( B:); SumMas(b,Sb); writeln;
Writeln(' C B =',Sb);
Readln;
END.
5.
A[1..10]. , , - .
Program Pr5;
Const n=10;
Var a, x, y: array[1..n] of integer;
i, k, m: integer; {k- X, m- Y}
BEGIN
randomize;
writeln(' :');
for i:=1 to n do begin { A}
a[i]:= random(51); Write(a[i]:4);
end;
writeln; k:=0; m:=0;
for i:=1 to n do
{ , , - Y}
if a[i] mod 2=0 then begin k:=k+1; x[k]:=a[i]; end
else begin m:=m+1; y[m]:=a[i]; end;
writeln(' X'); for i:=1 to k do write(x[i]:4); { }
writeln; writeln(' Y'); for i:=1 to m do write(y[i]:4); { Y}
END.
6.
N*M.
Program pr6;
Const n=2; m=5; {n- , m- }
Var Mt: array [1..n,1..m] of integer;
J, S, I: integer;
BEGIN
Writeln ( );
For I:=1 to n do { }
For j:=1 to m do begin
Write ('Mt [', I, ,, j, ']= '); Readln (Mt[i,j]);
End;
S:=0; For I:=1 to n do { }
For j:=1 to m do
S:=S+Mt[i,j];
Writeln ( = , S);
END.
7.
A[1..5,1..5] , 5.
Program p7;
Var a: array[1..5,1..5] of integer;
i, j, s: integer;
BEGIN
randomize; for i:=1 to 5 do begin { }
for j:=1 to 5 do begin
a[i,j]:=random(80); write(a[i,j],' ');
end; writeln;
end;
s:=0; for i:=1 to 5 do { }
for j:=1 to 5 do
{ 5, }
if (i=j) and (a[i,j] mod 5=0) then s:=s+a[i,j];
writeln('s=',s)
END.
8
( 1- , 2- . .). 3 . , ?
Program pr8;
Var a: array[1..5,1..3] of integer;
i, j, m, s1, s5: integer;
BEGIN
randomize; { }
for i:=1 to 5 do
for j:=1 to 3 do begin
a[i,j]:=random(10)+20; write(a[i,j],' ');
end;
writeln
end;
m:=a[3,1];for i:=1 to 3 do { 3- }
if a[3, i]>m then m:=a[3,i];
writeln(' ', m);
{ 1- 5- }
For j:=1 to 3 do begin
s1:=s1+a[1,i]; s5:=s5+a[5,i]
end;
{ 1- 5- }
if s1>s5 then writeln(' 1 ')
else if s1<s5 then writeln(' 5 ')
else writeln(' 5- 1- ')
END.
1. 15 , [-10, 30]. .
2. 10 , [10, 50]. .
3. 15 , [10, 90]. .
4. [1..20]. n- k- (n k )
5. , .
6. . , .
7. .
8. n , . , , .
9. A[1..20]. , .
10. [1..15]. n- k-.
11. [1..20]. , .
12. K[1..10]. , , .
13. [1..20]. , .
14. 15 . , 20 300 . .
15. 20 . , 50 700 . .
16. , . , .
17. , . , S.
18. 50 . , .
19. 15 , . : ) ; ) , ; ) .
20. , . : ) ; ) , ; ) .
21. 8 . : ) ; ) ; ) .
22. 20- . : ) ; ) , ; ) , .
23. . : ) ; ) , ; ) , .
24. 15 . : ) ; ) , ; ) , .
25. 20 . : ) ; ) ; ) , ;
26. ( , ..). 4 . : ) 5- ; ) 9- .
27. 10 ( , ..). : ) , ; ) , .
28. .
29. 10 . ( , ..). : ) ; ) , 6 .
30. ( , ..). 8 . : ) ; ) 1 .
31. 8 ( , ..). : ) ; ) , .
32. 12- ( , ..). : ?
33. 20 ( , ..). , , ?
34. ( , ..). 10- 11-.
35. 12- ( , ..). . 3- 4- .
36. 4x6. . .
37. 10x8, [19,49]. .
38. 4x8, [-20,30]. .
39. 85, [30,70]. .
40. 5x5. .