Алгоритмический язык Pascal | ||||
For i:= N1 To N2 Do ""; For i:= N1 DownTo N2 Do ""; a1, a2, a3, . . . , an Sn = a1 + a2 + a3+ . . . + an 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. an= p*Sn-1, Sn= Sn-1 + an = Sn-1*(1+), :Sn = S0*(1+p)N, "S0" - .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. 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 "";- : "". :
a1, a2, a3, ... , an, ... :a1 + a2 + a3 +... + an+... an - .
1 + 1/32 + 1/52 + . . . + 1/(2*N-1) 1 + 1/2! + 1/4! + 1/6! + ... + 1/(2*N)! + ... ; N = 0, 1, 2, ... : an = an-1*k;
an = 1/(2*N)! = 1/( 1*2*...*(2*N-2)*(2*N-1)*2*N) 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; - . 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 Ћабораторные работы по программированию —правочник |
Нет комментариев. Оставить комментарий: |