accccchhhhhh jangarrrrrrrr
program simpson;
uses crt;
var
i,n : integer;
a,b,x,sum,hasil,h : real;
begin
clrscr;
writeln('mencari nilai integral f(x)=1/(1+x) dr a sampai b');
write('masukan nilai a : ');readln(a);
write('masukan nilai b : ');readln(b);
write('masukan nilai h : ');readln(h);
n:=round((b-a)/h);
x:=a;
sum:=1/(1+x);
for i:=1 to n-1 do
begin
x:=x+h;
if (i mod 2)<>0 then
sum:=sum+4*(1/(1+x))
else
sum:=sum+2*(1/(1+x));
end;
x:=x+h;
sum:=sum+(1/(1+x));
hasil:=(b-a)*sum/(3*n);
writeln('hasilnya : ',hasil:12:5);
readln;
end.