g)
uses crt;
var n,i:integer;
s:real;
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
if i mod 2=1 then s:=s+1/i
else s:=s-1/i;
writeln(s:4:2);
readln;
end.
h)
uses crt;
var s:real;
i,n,x:longint;
{---------------------chuong-trinh-con-giai-thua--------------------}
function gthua(x:longint):real;
var gt:real;
i:longint;
begin
gt:=1;
for i:=1 to x do
gt:=gt*i;
gthua:=gt;
end;
{---------------------chuong-trinh-con-luy-thua---------------------}
function lthua(x,y:longint):real;
var lt:real;
i:longint;
begin
lt:=1;
for i:=1 to y do
lt:=lt*x;
lthua:=lt;
end;
{-------------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('Nhap x='); readln(x);
write('Nhap n='); readln(n);
s:=1;
for i:=1 to n do
s:=s+lthua(x,i)/gthua(i);
writeln(s:4:2);
readln;
end.