a = input(' Lower limit of integral, a = ');
b = input(' Upper limit of integral, b = ');
N = input(' Number of sample points, N = ');
sum = 0;
for i = 1:N,
    y = rand(1);
    x = a + (b - a)*y;
    sum = sum + (b - a)*g(x);
end
sum = sum/N