I
I
IndusDev2018-05-24 10:47:32
Pascal
IndusDev, 2018-05-24 10:47:32

Calculate to the given precision. Is it the right decision?

5b066d8ee4999665078110.png
Actually, I decided:

var a,E,sum,l: real;
    k,n:integer;

begin
  repeat
    write('Введите a (a<>0): ');
    read(a);
  until (a<>0);
  
  repeat
    write('Введите E точность (E>0): ');
    read(E);
  until (E>0);
  
  l:=1;
  k:=0;
  sum:=0;
  n:=0;
  
  repeat
    l:=l*(a+k);
    sum:=sum+(1/(l));
    k:=k+1;
  until (abs(sum)<E);
  
  writeln('Sum=',sum);
end.

But, it turns out that the answer in any case will be the result of the expression 1/a.
Maybe I'm confusing the concept of "with a given precision", but the Internet says that the modulus of the value must be less than the given precision.
If the result is 1/a

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Developer, 2018-05-24
@IndusDev

The difference between the previous value of sum and the current one must be modulo less than E

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question