fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. const int mval = 500;
  5. int r[1001];
  6.  
  7. int coot[501];
  8.  
  9. int j=0;
  10. int i=0;
  11.  
  12. int main(){
  13.  
  14. for(i; i<1000; i++){
  15. r[i] = rand() * mval;
  16. coot[r[i]]++;
  17. }
  18.  
  19. for(i=0; i<mval; i++)
  20. while(coot[i]>0){
  21. r[j] = i;
  22. coot[i]--;
  23. j++;
  24. printf("%i, ", i);
  25. }
  26.  
  27. return 0;
  28.  
  29. }
Runtime error #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
Standard output is empty