fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7. printf("Массив до:\n");
  8. int length=30;
  9. int A[length];
  10. int i, j, Xmin = -1000, Xmax = 1000;
  11. srand(time(NULL));
  12. for (i=0; i<length; i++)
  13. {
  14. A[i] = -1000+rand()%(Xmax-Xmin+1);
  15. printf("%d ", A[i]);
  16. }
  17. printf("\nМассив после:\n");
  18. for (i=0; i<length; i++)
  19. {
  20. int Amin=A[i];
  21. for (j=i+1; j<length; j++)
  22. if (Amin>A[j])
  23. {
  24. int a = Amin;
  25. Amin = A[j];
  26. A[j] = a;
  27. }
  28. else
  29. {
  30. Amin = Amin;
  31. }
  32. printf("%d ", Amin);
  33. }
  34. return 0;
  35. }
Success #stdin #stdout 0s 5332KB
stdin
Standard input is empty
stdout
Массив до:
-113 511 925 416 994 -860 -59 -792 278 151 -444 640 -605 -634 -982 -40 -285 344 424 -334 403 765 -661 510 -105 -412 44 268 764 -311 
Массив после:
-982 -860 -792 -661 -634 -605 -444 -412 -334 -311 -285 -113 -105 -59 -40 44 151 268 278 344 403 416 424 510 511 640 764 765 925 994