Алгоритмический язык Pascal

, . :
                  For  i:= N1    To    N2  Do  "";
                  For  i:= N1  DownTo  N2  Do "";
i - ( ),
N1, N2 - i.
N1, N2 , .
, "" : Begin "" end;
:


"To" N1 <= N2 i N1 N2. DownTo N1 >= N2 i N1 N2.
- .
"i" .
. , .

a1, a2, a3, . . . , an

Sn = a1 + a2 + a3+ . . . + an

, :
an = an-1 + d; Sn = (a1 + an)*n/2; - ,
an = an-1 * q; Sn= (a1 - an*q)/(1-q); - ,
d q - .
N- (N-1)- . .
, 1 N. : 12 + 32 + 52 +. . . + (2*N-1)2; Sn = N*(4*N2-1)/3;
PROGRAM SUM_K;                     {    }
var
  a, S, Sn, i, N : word;
Begin   
  write('    N=');
  readln(N);
  S:= 0;
  For i:= 1 to N do
    begin                          {    }
      a := Sqr(2*i-1);
      S:= S+a
    end;
  Sn := N*(4*N*N-1) div 3;
  Writeln('  S=',  S:10:2);        
  Writeln('     Sn=',  Sn:10:2);
  Writeln(' Enter');
  ReadLn   
End. 
"N"- , ,

an= p*Sn-1,

Sn= Sn-1 + an = Sn-1*(1+),

:

Sn = S0*(1+p)N,

"S0" - .
N "pr" (5% c pr=5).
PROGRAM VKLAD;        {       }
var
  S, Sn, pr : Real;
  i, N      : Integer;
Begin
  Write('    S=');
  readln(S);
  Write('    pr=');
  readln(pr);
  Write('    N=');
  readln(N);
  For i:= 1 to N do S:= S*(1+pr/100);     {   }
  Writeln('   S=',  S:10:2);
  {    "Sn"   }
  Writeln('      Sn=', Sn:10:2);
  Writeln(' Enter');         
  readln  
End. 
. , .
y = A*sin(x) - cos(x)/A; "x" 0 Pi Pi/100 "A" 1 3 0.5.
Program tabl;
var
  y, x, a, dx : real;
  i, j: integer;
Begin
  Writeln('   :  y=A*sin(x)-cos(x)/A; ');
  Writeln('--------------------------------------------------');
  Writeln('|   X   |  A=1.0 | A=1.5 | A=2.0 | A=2.5 | A=3.0 |');
  Writeln('--------------------------------------------------');
  dx := pi/100;
  for i:= 0 to 100 do
     begin    {     "X" }
       x:= dx*i;
       Write( x:8:4 );
       for j := 1 to 5 do
         begin{     "A" }  
           A := 0.5*(j+1);
           y := A*sin(x)-cos(x)/A;    Write(y:8:4)  
         end;
       Writeln;                                   {    }
       if ((i+1) mod 20) = 0 then readln{     Enter}
     end;
  readln;
End. 
- :
                      While  ""  DO  "";   
- : "",

                      Repeat  ""  Until  "";  
- : "".
"" - (Boolean).

:

WHILE REPEAT


While "" (True), (False), , . . While . While , , , "" . : Begin "" end.
Repeat , (False), , (True), . . Repeat .
Repeat , "" . .
, , , .

a1, a2, a3, ... , an, ...

:

a1 + a2 + a3 +... + an+...

an - .
"Sn".
"S", . . , :

1 + 1/32 + 1/52 + . . . + 1/(2*N-1) + ...

S = Pi2/8 an = 1/(2*N-1)2, N = 1, 2, 3, ...
. Eps=abs(S-Sn), Eps=abs(an), S . Eps_o=abs((S-Sn)/S), Eps_o=abs(an/Sn).
: Sn = Sn-1 + an
k1=-1, : k1:=-k1, an=k1*an. "N"- "N-1"-, , :

1 + 1/2! + 1/4! + 1/6! + ... + 1/(2*N)! + ... ; N = 0, 1, 2, ...

: an = an-1*k;
k = an/an-1 - ( ).

an = 1/(2*N)! = 1/( 1*2*...*(2*N-2)*(2*N-1)*2*N)
an-1 = 1/(2*(N-1))! = 1/((2*N-2))! = 1/(1*2*...*(2*N-2))
k = an/an-1 = 1/((2*N-1)*2*N)

N! = 1*2*3*...*N; - "N", 0! = 1.
, , :
  N  := 0;
  a  := 1;
  SN := 1;
  S  := (e+1)/e;
  e := 2.7182828;
  Repeat
    N := N+1;
    k := 1/((2*N-1)*2*N);
    a := a*k;    
    SN := SN+a;
    Writeln('  Sn= ',  Sn:11:6);
  Until abs(S-Sn) < eps;              { eps -   }
  Writeln('  S = ', SN:11:6);
. :
     Continue;   -   , 
     Break;      -   .    
Continue Break . Continue , . Break , , . Continue Break . .
  For i := 1 to 3 do
    begin       
      Write( ' :' );    Readln(S); {S  Parol -   }
      If S = Parol  Then  Break                                 {   }
      else  If   i <> 3  Then Continue;                        {   }
      Writeln( '   ' ); 
      Writeln( ' Enter' );
      Readln;
      Halt                                                  {   } 
    end;                                                   {   }
—одержание
    ”чебник по ¤зыку Pascal          Ћабораторные работы по программированию          —правочник




Нет комментариев.



Оставить комментарий:
Ваше Имя:
Email:
Антибот: *  
Ваш комментарий: