Question: #include #include static long num _ steps = 1 0 0 0 0 0 0 0 0 ; double step; int main ( ) {

#include
#include
static long num_steps =100000000;
double step;
int main ()
{
int i;
double x, pi, sum =0.0;
double start_time, run_time;
step =1.0/(double) num_steps;
start_time = omp_get_wtime();// this is the timer we want to use when using
OpemMP
for (i=1;i<= num_steps; i++){
x =(i-0.5)*step;
sum = sum +4.0/(1.0+x*x);
}
pi = step * sum;
run_time = omp_get_wtime()- start_time;
printf("
pi with %ld steps is %lf in %lf seconds
",num_steps,pi,run_time);
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!