Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main ()
- {
- int a[1002], i, n, j, aux;
- 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])
- {
- aux = a[i];
- a[i] = a[j];
- a[j] = aux;
- }
- }
- for (i = 1 ; i <= n ; i++)
- cout << a[i] << ' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement