program FP uses CRT var flag boolean integer IP IL sl real begin sl 00

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
program FP;
uses CRT;
var flag:boolean;
a,b,i,n,c:integer;
h,IP,IL,e,s,sl,x,f:real;
begin
a:=0;b:=1;n:=2;sl:=0;e:=0.000001;c:=0;
while not(flag) do begin
h:=(b-a)/n;
x:=a+c*h;
s:=0;
for i:=0 to n-1 do begin
F:=sqrt(1+sqr(x));
s:=s+F;
x:=x+h;
end;
s:=s*h;
if (abs(s-sl)<=e)then begin sl:=s; n:=2*n; end else flag:=true;
end;
writeln (n,' ',s);
readln();
end.