Răspuns:
#include <iostream>
using namespace std;
void ordonare(int a[], unsigned n)
{
int aux;
for (int i = 0; i < n; i++)
{
for (int j = i; j < n; j++)
{
if (a[i] < a[j])
{
aux = a[i];
a[i] = a[j];
a[j] = aux;
}
}
}
}
int main()
{
int n, S = 0;
int a[100];
cout << "n:";
cin >> n;
for (int i = 0; i < n; i++)
{
cout << "Introduceti numarul:";
cin >> a[i];
}
ordonare(a, n);
for (int i = 0; i < n / 2; i++)
{
S += a[i];
}
cout << "Suma este:" << S;
}