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. printf("%d ", Amin);
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Массив до:
60 661 638 81 107 -645 -974 -947 -247 -307 988 198 641 187 -541 -375 -320 182 547 -56 717 7 -192 -186 -324 -81 247 -256 977 513 
Массив после:
-974 -947 -645 -541 -375 -324 -320 -307 -256 -247 -192 -186 -81 -56 7 60 81 107 182 187 198 247 513 547 638 641 661 717 977 988