Advertisement
alex326

Untitled

Apr 16th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. problema 509
  2.  
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7. long long v[1000],n,i,j,c;
  8. cin>>n;
  9. for (i=0;i<n;i++)
  10. cin>>v[i];
  11. for (i=0;i<n;i++)
  12. for (j=i+1;j<n;j++)
  13. if (v[i]>v[j])
  14. {
  15. c=v[i];
  16. v[i]=v[j];
  17. v[j]=c;
  18. }
  19. for (i=0;i<n;i++)
  20. cout<<v[i]<<' ';
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement