Răspuns:
#include <iostream>
using namespace std;
int main()
{
int n, A[1001];
cin >> n;
for (int i=1;i<=n;i++)
cin >> A[i];
for (int i=1;i<n;i++)
for (int j=i+1;j<=n;j++)
if (A[i] > A[j])
swap (A[i],A[j]);
for (int i=1;i<=n;i++)
if (A[i] % 2 == 0)
cout << A[i]<<" ";
return 0;
}