I've written a programm to solve the integral X^2+2 by rectangles method
program fourrr;
var a, b : real; { borders }
h : real; { increment argument }
s : real; { approximate value of the integral }
n : integer; { number of intervals }
x : real; { argument }
y : real; { function value at the beginning of interval }
i : integer;
begin
write('lower border a: '); read(a);
write('upper border b: '); read(b);
write('increment argument h: '); read(h);
n := (b - a) / (h + 1);
x := a;
s := 0;
i := 1;
while i <= n do
begin
y := x * x + 2; // function value at the beginning of interval
s := s + (y * h);
x := x + h;
end;
writeln('Integral value: ', s);
end.
but i cannot solve the problem with data types conversion when I run it.
So please help me it's very important. Thanks