fork(1) download
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <time.h>
  4.  
  5. int main(void)
  6. {
  7. clock_t start, end;
  8. start = clock();
  9. int a[100];
  10. int i = 0, j = 0, k = 0;
  11. srand((unsigned)time(NULL));
  12. for (i = 0; i < 100; i++) {
  13. for (j = 0; j < 100; j++) {
  14. a[j] = rand()%100;
  15. for(k = 0; k < j; k++)
  16. if (a[j] == a[k]) {
  17. j--;
  18. break;
  19. }
  20. }
  21.  
  22. /*for(int j = 0; j < 100; j++)
  23.   printf("%d\t",a[j]);
  24.  
  25.   printf("\n\n"); */
  26. }
  27. end = clock();
  28. double diff = end - start;
  29. printf(" %f sec", diff / CLOCKS_PER_SEC );
  30. system("PAUSE");
  31. return 0;
  32. }
Success #stdin #stdout #stderr 0.01s 4248KB
stdin
Standard input is empty
stdout
 0.004574  sec
stderr
sh: 1: PAUSE: not found