fork download
  1. #include"stdio.h"
  2. #include "stdlib.h"
  3. int main()
  4. {
  5. int i;
  6. int j;
  7. int a=0;
  8. int b[12]={-1,0,5,2,7,0,18,5,4,3,9,1};
  9. for (i=0;i<12-1;i++)
  10. {
  11. for(j=0;j<12-1;j++)
  12. {
  13. if(b[j]>b[j+1])
  14. {
  15. a=b[j];
  16. b[j]=b[j+1];
  17. b[j+1]=a;
  18. }
  19.  
  20. }
  21. }
  22. for(j=0;j<=11;j++)
  23. printf("%d\n",b[j]);
  24. printf("\n");
  25. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
-1
0
0
1
2
3
4
5
5
7
9
18