I'm assuming that n is the number of points along the curve to take, or in other word, delta = 1-(-1)/n = 2/n.... I'm also assuming that Y=f(x)... In this case, something like this may work... (I haven't tested this, so there may be a bug or two)

#include <math.h>

#include <stdio.h>

double f(double);

double Area(int, double, double);

void main()

{

int num_points = 100;

printf("Area under the curve is: %lf", Area(num_points. -1.0, 1.0));

}

double f(double x)

{

return(exp((-pow(x,2))/2.0));

}

double Area(int n, double start, double end)

{

double area = 0.0;

double delta = 0.0;

long int count = 0;

delta = (end - start) / n;

area = f(start) / 2.0;

area += f(end) / 2.0;

for(i=start+delta ; i<end ; i+=delta)

{

count++;

area += f(start + (count * delta));

}

return(area);

}

#include <math.h>

#include <stdio.h>

double f(double);

double Area(int, double, double);

void main()

{

int num_points = 100;

printf("Area under the curve is: %lf", Area(num_points. -1.0, 1.0));

}

double f(double x)

{

return(exp((-pow(x,2))/2.0

}

double Area(int n, double start, double end)

{

double area = 0.0;

double delta = 0.0;

long int count = 0;

delta = (end - start) / n;

area = f(start) / 2.0;

area += f(end) / 2.0;

for(i=start+delta ; i<end ; i+=delta)

{

count++;

area += f(start + (count * delta));

}

return(area);

}