#include <iostream>
#include <ctime>
#include <cmath>

using namespace std;

int main(void)
{
    const unsigned long LOTS = 50000000;
    time_t start, end;
    double x = LOTS*M_PI;

    cout << "x starts as " << x << ",\nM_PI is " << M_PI
         << ",\nand LOTS is " << LOTS << endl;
    start = time(nullptr);

    for (unsigned long i = 0; i != LOTS; i++)
    {
        x /= M_PI;
    }

    end = time(nullptr);
    long diff = end-start;
    cout << "It took " << diff << " seconds (" << (diff/(double)LOTS)
         << " sec/div) to find " << "out that x is " << x << "." << endl;

    return 0;
}
