Răspuns:
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
int v[10],n,i,j,aux;
cout<<"Dati nr de elemente : ";
cin>>n;
for (i=0;i<n;i++){
cout<<"v[i] = ";
cin>>v[i];
}
for(i=0;i<n;i++)
{for(j=i+1;j<n;j++)
if(v[i]>v[j])
{
aux=v[i];
v[i]=v[j];
v[j]=aux;
}
}
for (i=0;i<n;i++)
cout<<" "<<v[i];
return 0;
}
Explicație: