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