fork download
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int t,a[10^6];
  5. int i,j,temp;
  6. printf("\n enter the no. of test cases");
  7. scanf("%d",&t);
  8. for(i=0;i<t;i++)
  9. {
  10. scanf("\n%d",&a[i]);
  11. }
  12. for(i=0;i<t;i++)
  13. {
  14. for(j=i+1;j<t;j++)
  15. {
  16. if(a[i]>a[j])
  17. {
  18. temp=a[i];
  19. a[i]=a[j];
  20. a[j]=temp;
  21. }
  22. }
  23. }
  24. for(i=0;i<t;i++)
  25. {
  26. printf("\n%d",a[i]);
  27. }
  28. }
Success #stdin #stdout 0s 2116KB
stdin
5 2 3 6 1 4
stdout
 enter the no. of test cases
1
2
3
4
6