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