Advertisement
luizaspan

time.h library

Jun 30th, 2015
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <math.h>
  4.  
  5. #define N 1000000000
  6.  
  7. clock_t start,stop;
  8.  
  9. main()
  10. {
  11.     int i;
  12.     double x;
  13.  
  14.     start = clock();
  15.  
  16.     for (i=0;i<N;i++)
  17.         x=x*3;
  18.  
  19.     stop = clock();
  20.  
  21.     printf("%d %f \n",N,(double) (stop-start)/(CLOCKS_PER_SEC));
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement