Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. Void sekw()
  2. {
  3.     fprintf(result_file, "Przetwarzanie sekwencyjne;\n");
  4.     clock_t start, stop;
  5.     double x, pi, sum=0.0;
  6.     inti;
  7.     step = 1./(double)num_steps;
  8.     start = clock();
  9.     for (i=0; i<num_steps; i++)
  10.     {
  11.         x = (i + .5)*step;
  12.         sum = sum + 4.0/(1.+ x*x);
  13.     }
  14.     pi = sum*step;
  15.     stop = clock();
  16.     printf("    Wartosc liczby PI wynosi %15.12f\n",pi);
  17.     printf("    Czas przetwarzania wynosi %f sekund\n",((double)(stop - start)/1000.0));
  18.     fprintf(result_file, "Czas przetwarzania wynosi ;%f ;sekund\n",((double)(stop - start)/1000.0));
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement