Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- using namespace std;
- int main()
- {
- int n,j,i,x;
- cin>>n;
- vector<int>ar;
- for(i=0;i<n;i++)
- {
- cin>>x;
- ar.push_back(x);
- }
- for(i=1;i<n;i++)
- {
- for(j=0;j<n-i;j++)
- {
- if(ar[j]>ar[j+1])
- {
- swap(ar[j],ar[j+1]);
- }
- }}
- for(i=0;i<n;i++)
- {
- cout<<ar[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement