// Numeric Integration
// Determines integration of (x + 2)
// From x = 0 to x = 10;
// Total 100 strip is considered
// Exact answer is 70

#include<iostream>

using namespace std;

double f(double x)
{
    double y = x + 2;

    return y;
}

int main()
{
    double A = 0;   // Integration result
    int N = 100;    // Total steps

    double lower = 0;   // Lower limit of integration
    double upper = 10;  // Upper limit of integration

    double width = (upper - lower) / N; // Each strip width

    for(double x = lower; x <= upper; x += width)
    {
        A += f(x) * width;
    }

	cout << "Result : " << A << endl;

    return 0;
}
