Program HOC24;
var s: real;
i,n: integer;
function tong(x: integer): longint;
var j: integer;
t: longint;
begin
t:=0;
for j:=1 to x do t:=t+j;
tong:=t;
end;
function tich(s: integer): longint;
var j1: integer;
t1: longint;
begin
t1:=1;
for j1:=1 to s do t1:=t1*j1;
tich:=t1;
end;
begin
write('Nhap N : '); readln(n);
for i:=1 to n do s:=s+tong(i)/tich(i);
write('S = ',S:2:2);
readln
end.
uses crt;
var s:real;
i,n:longint;
{------------ham-tinh-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-tinh-tong---------------------}
function tong(x:longint):real;
var t:real;
i:longint;
begin
t:=0;
for i:=1 to x do
t:=t+i;
tong:=t;
end;
{------------------chuong-trinh-chinh--------------------}
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+(tong(i)/gthua(i));
writeln('Ket qua la: ',s:4:2);
readln;
end.