Guest User

Untitled

a guest
Jan 24th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <time.h>
  2. #include <stdio.h>
  3. int main(void)
  4. {
  5. int t;
  6. int s;
  7. clock_t start1, start2, end1, end2;
  8. double cpu_time_used1, cpu_time_used2;
  9.  
  10. start1 = clock();
  11. t = ft_is_prime(10000);
  12. end1 = clock();
  13. cpu_time_used1 = ((double) (end1 - start1)) / CLOCKS_PER_SEC;
  14. printf("ft_is_prime took %f seconds to execute \n", cpu_time_used1);
  15.  
  16. start2 = clock();
  17. s = ft_is_prime(32767);
  18. end2 = clock();
  19. cpu_time_used2 = ((double) (end2 - start2)) / CLOCKS_PER_SEC;
  20. printf("ft_is_prime took %f seconds to execute \n", cpu_time_used2);
  21. }
  22. /*
  23. ft_is_prime took 0.000002 seconds to execute
  24. ft_is_prime took 0.000000 seconds to execute
  25. */
Add Comment
Please, Sign In to add comment