Решить задачу с использованием цикла while
Дан числовой ряд и некоторое число eps. Найти сумму тех членов ряда, модуль которых больше или равен заданному eps. Общий член ряда имеет вид:
an=n!/(2*n)!
Я составила программу, но она не идет. выдает один и тот же ответ при вводе любого числа. помогите пожалуйста найти ошибку
function a(n:integer):double;
var
i:integer;
f1,f2:double;
begin
f1 := 1;
for i := 1 to n do
f1 := f1 * i;
f2:=1;
for i:=1 to 2*n do

f2:= f2 * i;
a := f1 / f2;
end;

var
i:integer;
eps,s,an:double;
begin
Write('eps='); Read(eps);
s:=0; i:=1;
while an>=eps do
an:=a(i);
if an>=eps then begin s:=s+an;
Inc(i) end;
Writeln('s=',s);
end.
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Copyright © 2024 SCHOLAR.TIPS - All rights reserved.