#include <iostream.h>
//The following program calculates an approximation to the
//integral of x squared between x=0 and x=1
int main()
{
	double n;
	
	cout << "How many subdivisions of the interval would you like? "
	     << endl;
	     
	cin >> n;
	
	double delta_x = 1/n;
	double sum=0;
	for (double k=0; k<=1; k+=delta_x)
		sum += k*k;
	double area = sum * delta_x;
	
	cout << "The EXACT area under the curve of x squared "
	     << "between x=0 and x=1 is:  0.33333...." << endl;
	
	cout << "The APPROXIMATE area under the curve is:  "
	     << area << endl;
	     
	return 0;
}

