.


- 7


s := s + v; p := p + 1

until s>=n;

m := s - n; p := p - 1; q := 1;

for i := 1 to m do q := q*10;

c := p div q;

c := c mod 10;

writeln(' ', c);

writeln(' ', p)

end;

20. :

repeat ... until

...

 

Procedure extent(a, n : integer; var s : integer);

var

i : integer;

begin

i := 1; s := 1;

repeat

s := s*a; i := i + 1

until i = n

end;

 

for ... to

... do ...

 

Procedure extent(a, n : integer; var s : longint);

var

i : integer;

begin

s := 1;

for i := 1 to n do s := s*a

end;

:

Function extent(a, n : longint) : longint;

var

i : integer;

begin

extent := 1;

for i := 1 to n do extent := extent*a

end;

21. :

 

Procedure fac(n : integer; var f : longint);

var

i : integer;

begin

if n = 0 then f := 1 else for i := 1 to n do f := f*i

end;

 

 

Procedure fac(n : integer; var f : longint);

begin

if (n = 0) or (n = 1) then f := 1

else

begin

fac(n - 1, f);

f := f*n

end

end;

22. a b, :

Procedure umnogenie(a, b, s : integer);

begin

if b <> 0




- -  - -  - -