Răspuns:
#include <iostream>
using namespace std;
int main()
{
int V[100], n, i, j, S1, S2, x, y;
cin >> n;
for(i = 1; i <= n; i++)
cin >> V[i];
for(i = 1; i <= n; i++){
S1 = 0;
x = V[i];
while(x){
S1 = S1 + x % 10;
x = x / 10;
}
for(j = i + 1; j <= n; j++){
S2 = 0;
y = V[j];
while(y){
S2 = S2 + y % 10;
y = y / 10;
}
if(S1 == S2)
cout << V[i] << "-" << V[j] << endl;
}
}
return 0;
}