.


:




:

































 

 

 

 


.




. Turbo Pascal. .

1.

2.

3.

4.

5.

6.

7.

8.

9.

10.

11.

 

12.

13.

14.

15.

16.

17.

18.

19.

20.

 

1. n. n!.

:

n! - 1 . 0!=1!=1; 2!=1×2= 2; 3!= 2×3= 6; 4!=6×4=24 .. , n!=(n-l)!×n. . , , . Ÿ n:

, . 3.1.

 

. 3.1. 1

Turbo Pascal :

Program factorial;

Var n,i,f: Integer;

Begin

Write(' ');

ReadLn(n);

f:=1;

For i:=2 to n do f:=f*i;

WriteLn(n:40, ' f = ', f:0:0);

Write(' _ :');

Write(n:5,'f =', Sqrt(2*Pi*n)*_ Exp(n*(Ln(n)-1)):5:3);

ReadLn;

End.

2. n. :

a) )

:

) , . 3.2.

Turbo Pascal :

Program Square_a;

Var x: Extended;

i,n: Byte;

Begin

Write(' N = ');

ReadLn(n);

x:=0;

For i:=l to n do x:=Sqrt(2+x);

WriteLn(x);

ReadLn;

End.

Ö

. 3.2. - 2

) , ). :

:=0;

For i:=n downto 1 do x:=Sqrt(3*i+x);

3. sin , .

n, Xk d X. - . , - . .:

X Y
-4.00 0.76
-3.00 -0.14
-2.00 -0.91
-1.00 -0.84
0.00 0.00
1.00 0.84
2.00 0.91
3.00 0.14
4.00 -0.76

 

, . 3.3.

Turbo Pascal :

Program tab_fun;

Var x,y,Xn,Xk,dx:real;

Begin

Writeln(' Xn, Xk, dX');

Readln(Xn, Xk, dX);

Writeln(' ------------------------- ');

Writeln('| X | Y |');

Writeln(' ------------------------- ');

x:=Xn;

While x <= Xk do begin

:=sin(x);

Writeln('|', :9:2,' |', :9:2,' |');

:=+dX;

End;

Writeln(' ------------------------- ');

End.

 

. 3.3. - 3

4. sin e :

. , e.

n- :

, (n+1)- n-, , , .

. (n+1) - , (n+1) n:

, n, n+1:

, , , , . , .

Turbo Pascal :

Program sinus;

{ - - }

Const Maxlter = 500;

{ }

Var x, eps: double;

{ }

, : double;

n: integer; { }

{ }

done: boolean;

Begin

Writeln(' ;');

Readln(x, eps);

done:=true;

:=x; { }

:=; { }

n:= 1;

While abs(c) > eps do begin

{ }

:=-*sqr(x)/2/n/(2*n+l);

{ }

:=+;

inc(n); { . }

If n <= Maxlter then Continue;

Writeln(' !');

{ }

done:= false;

Break;

End;

If done then Writeln('ApryeT: ',_ x:10:6, #13#10, ' : ',_ :10:6, #13#10, ' ',_ eps:8:6, ' ', n, ' ');

Readln;

End.

. break, . #13#10 .

, , done, , . -, , .





:


: 2016-03-27; !; : 780 |


:

:

: , .
==> ...

1954 - | 1576 -


© 2015-2024 lektsii.org - -

: 0.025 .