Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
18BCE2182 LAB FAT-2-A-ii
//gcc 7.4.0 #include <omp.h> #include <stdio.h> #include <time.h> static long num_steps = 100000; double steps; int main(int argc, char* argv[]) { int i; double start, end, x, pi, sum = 0.0; steps = 1.0/(double) num_steps; start = omp_get_wtime(); #pragma omp parallel for private(x) reduction(+:sum) for (i=1; i<= num_steps; i++) { x = (i-0.5)*steps; sum = sum + 4.0/(1.0+x*x); } pi = sum / num_steps; printf ("\npi = %6.8f\n", pi); end = omp_get_wtime(); printf("\n\nExecution Time: %f",(end-start)); return 0; }
run
|
edit
|
history
|
help
0
PART 2
FloatInt
C_141113_Primos02
json string formatter
than mine time's ocean as real white shakedown marine is mistake
HelloWorld
sizeof human
use_of_bool_in_loop
20161118_ArrayRepetidos
time.c