Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,i,j,k,a[1000],temp;
- cin>>n;
- for(i=1; i<=n; i++)
- {
- cin>>a[i];
- }
- for(i=1; i<=n; i++)
- {
- for(j=i+1; j<=n; j++)
- {
- if(a[i] > a[j])
- {
- temp = a[i];
- a[i] = a[j];
- a[j] = temp;
- }
- }
- }
- for(i=1; i<=n; i++)
- {
- cout<<a[i]<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement