The program will compute the integral of a function f.

f(x)=exp(-x^2)

The program runs but i am getting wrong values. I am guessing i made mistake somewhere in the formula.

Answer should look like the following:

Number of subintervals:1000000Left endpoint:0.0Right endpoint:100.00, answer: 0.886227

Thanks For your help.Code:#include <stdio.h> #include <stdlib.h> #include <math.h> #include <conio.h> double f(double); int main() { double upperBound; double lowerBound; double n; double h; printf(" Enter upper and lower bound values \n"); scanf(" %lf %lf", &upperBound, &lowerBound); printf(" Enter number of N values \n"); scanf(" %lf", &n); //h = ((upperBound - lowerBound)/n); //double x=lowerBound; for (int i=0; i<n; i++) { //double x = lowerBound; double f(double x); //x = x + h; } printf(" The result is %lf\n", f); getch(); } double f(double x) { return exp(-x*x); }

I have also attached the file. I am using Dev c++ IDE.