Sửa đề : \(\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+...+\frac{1}{2n-1}-\frac{1}{2n-1}\)
Giải:
Program hotrotinhoc;
var n,i: integer;
s: real;
begin
write('Nhap N='); readln(n);
for i:=1 to n do
if i mod 2=0 then s:=s-1/(2*i-1) else s:=s+1/(2*i-1);
write('Gia tri gan dung cua Pi sau khi tinh la:',s*4:1:2);
readln
end.