.


:




:

































 

 

 

 


(while)




. , , , , , . , , .

while ( ) ( ) , .

:

while < > do

Begin

< 1>;

< 2>;

.;

< N>

end;

while (), do () - ; -, .

ij . (). ( true ), ( ). . ( false ), , .

- :

.

1. , . .

2. , true false, .

3. () 1. I:=I+1.

4. .

. x, s x= 4, s= 0. ϳ

while x<=8 do

Begin

s:=s+x; x:=x+1

End;

s =4+5+6+7+8=30, x= 9.

. 20 30, while : i:= 20;

while i <= 30 do

Begin

writeln(i:4, sqr(i):6, exp(3*ln(i)):8); i:= i + 1

End.

 

1. 1 N.

program SUMA1;

var I,N,S: integer; begin

writeln( :);

write(N=);

readln(N);

I:=1;

S:=0;

while I<=N do

Begin

S:=S+i; i:=i+1 end; writeln(S=,S)

end.

 

4. (repeat-until)

( ) , ( false, a trye ).

: repeat

< 1>;

< 2>;

.;

< N> until < >;

repeat (), until ( ) - ; - , .

, ( , , ).

ij . , . -. ( false ), . ( true ), .

.

1. ҳ , , (begin - end), repeat - until .

2. ҳ .

3. .

4. .

- :

. x, x= 5, y=0. repeat

:=+x;

z:=2*x;

x:=x2 until x<=1; y, z, x y =0+5+3=8, z=6, x =1.

2. 1 N.

program SUMA2;

var i,N,S: integer;

Begin

writeln( :);

write(N=);

readln(N);

i:=1;

S:=0;

Repeat

S:=S+i;

i:=i+1;

until i>N;

writeln(S=,S);

end.

 

Repeat Until KeyPressed ( - ). Turbo Pascal KeyPressed . , False, True.

1. .

2. .

3. , , , , .

:

1. .

2. .

3. n, x. .

4. n, x. .

5. n, x. .

6. n, x. .

7. n, x. .

8.

9. , 0,5 1,4 0,1.

10. Y = sinx, = 0,5.

11. 0,1.

12. 0,2 0,5. = .

 


ֲ

1. .

2. .

3. .

4. , , , -, ( ), ( ).

5. , .

6. ϳ .

 

,

˳ :

program SumaDobutok; uses Crt; var i: integer;

suma, dob, y: real;

fact: longint;

Begin

clrscr;

suma:=0; { , }

dob:=1;

fact:=1;

for i:= 1 to 25 do begin

fact:= fact*i; { (fact = 1*2*3**f}

suma: = suma+5*sqr(i)/fact; { }
dob:=dob*sqr(i); {}

End;

y:=suma+dob;

writeln(y=, y:7:2);

readln

End.

- :

 

 

____________ . .





:


: 2016-10-22; !; : 438 |


:

:

.
==> ...

1650 - | 1584 -


© 2015-2024 lektsii.org - -

: 0.021 .