.


:




:

































 

 

 

 


7.




.

(, ), , .

:

  1. () .
  2. ( ).
  3. .
  4. .
  5. () .
  6. , () .
  7. .
  8. .

( , ) :

Program < () >; Uses < , >; { , } Label < ( ), >; { } Const < ( ), >; { } Type < , >; { } Var < , >; { } { < > } { < > }Begin < , >; { } < ( )>; { } < ( ), >; { }End.

. v r h.

Program Vil;Uses Crt { / " " }Const pi = 3.14;Var r, h, v: real; { r h } { v }Begin ClrScr; { ( ) } ReadLn (r, h); { } v:=pi*r*r*h; { } WriteLn ( , v) { }End.

.

sqr(x)
x sqrt (x)
|| abs (x)
sin x sin(x)
cos x cos(x)
tg x tg(x)
ctg x ctg(x)
arcsin x arcsin (x)
arccos x arccos(x)
arctg x arctg(x)
ln x ln(x)
= 2, 7... x exp(x)
x mod y
y x div y
() int(x)
0 rnd(x)
length (x)

. : sqrt(9) = 3, abs(5) = 5, sin(0) = 0, cos(0) = 1, ln(1) = 0, exp(1) =e, 23 mod 5 = 3, 20 mod 5 = 0, 23 div 5 = 4, 20 div 5 = 4, int(2.7) = 2, int(2) = 2, rnd(0) = 0.231356, length() = 6.

( ) :

  1. ;
  2. ;
  3. ( "*" "/");
  4. ( "+" "").

. b*c + (d/t*(v/n/m))*sin(x) ( ): v/n, (v/n)/m, d/t, (d/t)*(v/n/m), sin(x), b*c, (d/t*(v/n/m))*sin(x), b*c+(d/t*(v/n/m))*sin(x) : .

.

1. () ():

Program < >;,

< > , (, , ).

2. ( ) :

Read (< >);

ReadLn (< >);.

( ), .

3. :

Write (< >);

WriteLn (< >);.

( ), .

4. :

<>:= <>;,

<> , <> . ":=" : <> , <>, , <>.

  1. () Begin.
  2. () End.

7. :

< > < >.

. , , , .

 

: , , .

1. :

< >;< >.

2. , , , , , .

if <> then <, > else <, >;.

() if (), then (), else (). , , ( ).

.

if (>y) { y, } then := { , } else x:= y; { ( <= y) x y }.

, , , .

if <> then <, >;.

3. () , .

" (while)" :

while < > do < >;

while < > do begin < 1>; < 2>;... < N> end;.

01.11.14

while (), do (), begin (), end ().

, ( ).

" while < >" .

: , () ; , .

. , n. , n .

"" 2. )

Program Summa;Uses Crt; { / " "}Var i, n, s: real; { 1, 3, 5, , } { s , s > n }Begin ClrScr; { ( ) } ReadLn (n); { } s:=1; { } i:=1; { } while (s<=n) do { ( ) } begin i:=i+2; { } s:=s+i { } end; WriteLn (' ', s); { }End.

"" (for),

for <>:= < > to < > do <>;

for <>:= < > to < > do begin < 1>; < 2>;... < N> end;.

<> , .

for (), to ().

: , ; , ..

. n ( , , ), 10, 2. "" , " " ,

Program ST;Uses Crt { / " "}Var i, n, s, x: integer; { n : 2, 12, 22, 32, } { s n s }Begin ClrScr { ( ) } ReadLn (n); { } s:=0; { } x:=2; { } for i:=1 to n do { ( ) } begin s:=s+x; { } x:=x+10 { } end; WriteLn (' ', s/n: 5:5); { }End.

() .

. n, n! = 1 * 2 * 3 *... * (n 1) * n c n! = (n 1)! * n. . :

1! = 1, 2! = 1 * 2 = 1! * 2, 3! = 1 * 2 * 3 = 2! * 3,..., m! =1 * 2 * 3 *... * (m 1) * m = (m 1)! * m.

, m! (m 1)! m, m = 1, 2,..., n.

Program Factorial;Uses Crt;Var n, f, i: integer; { n } { n }Begin ClrScr; WriteLn(' n: '); { } ReadLn(n); { } f:=1; { f 1, 1!=1 } for i:=1 to n do { f i } f:=f*i; { i } WriteLn(' f: ',f); { }End.

. n . n 2 . 1,0,1,0,0,1, c 100101.

Program S10-S2;Uses Crt;Var n, a, i, c: integer; { } { }Begin ClrScr; WriteLn(' : '); { } ReadLn(n); { } WriteLn(' :'); { "" } i:=0; { , } while (n>0) do { ( ) } begin i:=i+1; { } c:=n mod 2; { 2} n:=n div 2; { } write(c) { } end;End.




:


: 2016-12-05; !; : 673 |


:

:

, , . , .
==> ...

1388 - | 1224 -


© 2015-2024 lektsii.org - -

: 0.015 .