fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int T[20] = {67, 28, 98, 1, 24, 15, 14, 23, 51, 20, 11, 90, 66, 4, 56, 3, 50, 16, 78, 70};
  5. int n = 20;
  6.  
  7.  
  8. for (int i = 0; i < n - 1; i++) {
  9. for (int j = 0; j < n - 1 - i; j++) {
  10.  
  11. if (T[j] > T[j + 1]) {
  12. int temp = T[j];
  13. T[j] = T[j + 1];
  14. T[j + 1] = temp;
  15. }
  16. }
  17. }
  18.  
  19.  
  20. for (int i = 0; i < n; i++) {
  21. printf("%d", T[i]);
  22. if (i < n - 1) {
  23. printf(", ");
  24. }
  25. }
  26. printf("\n");
  27.  
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
1, 3, 4, 11, 14, 15, 16, 20, 23, 24, 28, 50, 51, 56, 66, 67, 70, 78, 90, 98