.


:




:

































 

 

 

 


- .

: 21. 02.2005. : 15.00. : 11

: . WHILE,REPEAT .UNTIL .

WHILE,REPEAT .UNTIL? , , . , ,.

- , , , , .

, ,

: 45 .

, : , , , Turbo Pascal 7.0. .

 

.

1. : . . , , .

( ).

:

, , :

1) , ; ?

2) Turbo Pascal 7.0.?

3) ? ?

? ?

4) , ?

5) FOR? ?

3. :

, .

:

.

. .

:

, , .

While <> Do < >;

, While. , < >, .. , , < > .

.

1. < >
,
.

2. ,
, .

.

. , 10 ( ).

Program Example_8;

Var m, n: Longint;

k: Integer; { }

Begin

Writeln(' '); { >0} ' Readln(n);

m:=n; k:=0;

While m<>0 Do

{ (While) m<>0 (Do)}

Begin

Inc(k); { k:=k+l;} m:=m div 10;

{"" } End;

Writeln(' ',n,' ', k, ');
{ }
Readln;
End.

 

 

65387:

 

n m k
     
     
     
     
     
     

: I
65387 5

, 0. .

i ; min k . , 0, <>0. min. ( ) , min , min , . , :

Program Exaraple_9;

Var x, i, min, k: Integer;

Begin

Writeln('

');

Read(x);

k:=l; min:=x; i:=2;

While x<>0 Do

Begin

If x<min Then

Begin

min:=x; k:=i-l;

End;

Writeln(' ',I,' '); Read(x);

Inc(i);

End;

Writeln(' ', k); End.

1. .
?

2. .
.

a:=n; ck:=0; While a>=0; Do

Begin

ck:=ck+l;

a:=a div 10

End;

, :

Repeat {}

< 1>;

< 2>;

....

< n>;

Until { } <>;

, . .

, , Begin End .

, , , , Until. , . , .

 

, .

k , , s . s . . , , , .

Program Example_10;

Var x, k, p, s: Integer;

Begin

Writeln(' ');

Readln(p);

s:=0;

Repeat

Writeln('

');

Readln (x, k);

s:=s+x*k;

Writeln (' ',s);

Until s>p;

Writeln { ' ');

End.

 

.
() . >. =0, (,)=, y<>Q, , r ,
r , (x,y)=(y,). "

, =48,y =18.

(48,18)=(18,12)=(12,6)==(6,0)=6.

.

:

Program Example;

Var , : Integer;

Begin

Writeln(' ');

Readln(,);

Repeat {}

If x>y Then := mod

Else := mod X;
Until (=0) or (y=0);

{ , }

Writeln('=', +)); { . }.

Readln;

End.

- , , (), . , 34 697 2 (3+4+6+9+7=29; 2+9=11; 1+1=2).

:

1. , ?

2. ( )?

3. : . ?

4. . ?

 

 

Program Example_18; Var n,k,s:Longint; Begin

Writeln{' 1);

Readln(n);

s:=n;

While s>9 Do

Begin

k:=s; s:=0; Repeat

s:=s+k mod 10; k:=k div 10; Until k=0; End;

Writeln(' ',n,' !,s); End.

1. , :

a) ;

b) ( ), .

2. N. , , , ,
, .

3. >2. . .

a) k , k , , n * pt*1; j

b) .

4. N . , N .

5. q. qt .

6. N, .

7. , ; 0 1, 7,( ).

8. :

:=1; :=1;

While a+b <8 Do

Begin a:=a+l; :=b-2; End;

s:=a+b;

a, b s ?

9 b :

:=1; :=1;

While a<=3 Do a:=a+l; b:=b+l;

10. s :

a) s:=0; i:=0;

Wnile i<5 Do Inc(i); s:=s+100 div i;

b) s:=0; i:=l;

While i>l Do

Begin s:=s+100 div i; dec(i) End;

11. f n .
.

k:=l; f:=0; While k<n Do f=f*k

k:=k+l.

12. , n ,

n
.

:=n;

While p>=0 Do

Begin.

a:=a+p mod 10;

p:=p div 10;
End;

13. .

14. .

15. 1
. , =3456 134561.

16.
.

17.
.

18. .

19 , 5.

20. ?

21. , ,
10 ,
, .

22. , ,
,
,

.

23. s :

s:=0; i:=l;

Repeat s:=s+5 div i; i:=!-!;

Until i<=l;

2. N .
?

3. fn :
f0=f1=1; fn=fn-1+fn-2 =2, 3,...

a) f4Q;

b) ,

) , 1000.

24. , .
,
,
( ,
, , ).

25.,
.

26,
.

27.
, 0.
,

 

 



<== | ==>
282,6 5,04,7 . 0,4/20 4/20 , 16; 25 50 . | , ).
:


: 2016-12-18; !; : 724 |


:

:

, .
==> ...

1542 - | 1396 -


© 2015-2024 lektsii.org - -

: 0.068 .