Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Database Modeling With Neo4j

Authors: Ajit Singh

2nd Edition

B0BDWT2XLR, 979-8351798783

More Books

Students also viewed these Databases questions

Question

What are the backgrounds of young people who join County Lines?

Answered: 1 week ago

Question

Draw a schematic diagram of I.C. engines and name the parts.

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago