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
qsort para struct
ForU
armstrong number using a while loop
cstructCensus
printing numbers without using loop
c program for hollow rhombus
Swap.c
lab 11 v0.7
Star 1,3
CremovePointFun