fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. freopen("out.txt","r",stdin);
  6. freopen("int.txt","w",stdout);
  7.  
  8. int n;
  9. cin>>n;
  10. int a[n];
  11. for(int i = 1; i <=n ; i++){
  12. cin >> a[i];
  13. }
  14. for( int i = 1; i< n ; i++){
  15. for( int j=i+1 ; j<=n ; j++){
  16. if(a[i]>
  17. a[j]){
  18. swap(a[i],a[j]);
  19. }
  20.  
  21. }
  22. }
  23.  
  24. for(int i = 1; i <=n ; i++){
  25. cout<< a[i]<< endl;
  26. }
  27.  
  28. }
  29.  
  30.  
  31.  
Success #stdin #stdout 0.59s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty