program laurin ;
uses wincrt;
var
x,y:array[1..1000] of real;
i,j,n:longint;
a,sum,p:real;
begin
readln(n);
readln(a);
sum:=0;
for i:=1 to n do
begin
x[i]:=-1/i;
p:=1;
for j:=1 to i do
p:=p*a;
y[i]:=p;
sum:=sum+x[i]*y[i];end;
writeln('hasil= ',sum:0:5);
writeln('asli= ',ln(1-a):0:5);
writeln('error= ',ln(1-a)-sum:0:5);
end.
Jumat, 09 Desember 2011
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar