giup minh lam cau nay bang pascal voi mn: Tính S(n) = x + x^2/2! + x^3/3! + … + x^n/N!
0 bình luận về “giup minh lam cau nay bang pascal voi mn: Tính S(n) = x + x^2/2! + x^3/3! + … + x^n/N!”
uses crt; var n,x,gt,lt,i:longint; s:real; begin clrscr; write(‘n=’);readln(n); write(‘x=’);readln(x); lt:=1; gt:=1; for i:=1 to n do begin lt:=lt*x; gt:=gt*i; s:=s+lt/gt; end; writeln(‘S(n)= ‘,s:0:5); readln end.
uses crt; var i,n,x:word; lt,gt:longint; s:real; begin clrscr; write(‘x=’);readln(x); write(‘n=’);readln(n); gt:=1; lt:=1; s:=0; for i:=1 to n do begin lt:=lt*x; gt:=gt*i; s:=s+lt/gt; end; writeln(s:0:3); readln; end.
uses crt;
var n,x,gt,lt,i:longint; s:real;
begin
clrscr;
write(‘n=’);readln(n);
write(‘x=’);readln(x);
lt:=1; gt:=1;
for i:=1 to n do
begin
lt:=lt*x;
gt:=gt*i;
s:=s+lt/gt;
end;
writeln(‘S(n)= ‘,s:0:5);
readln
end.
uses crt;
var i,n,x:word;
lt,gt:longint;
s:real;
begin
clrscr;
write(‘x=’);readln(x);
write(‘n=’);readln(n);
gt:=1;
lt:=1;
s:=0;
for i:=1 to n do
begin
lt:=lt*x;
gt:=gt*i;
s:=s+lt/gt;
end;
writeln(s:0:3);
readln;
end.