Rezolvare C++:
# include<iostream>
using namespace std;
unsigned suma(unsigned x)
{
unsigned s=0;
while(x)
{
s+=x%10;
x/=10;
}
return s;
}
int main()
{
unsigned n,v[101],i;
cin>>n;
for(i=1;i<=n;i++)
cin>>v[i];
for(i=1;i<=n;i++)
if(v[i]%suma(v[i])==0)
cout<<v[i]<<" ";
return 0;
}