Răspuns :
Răspuns:
#include <iostream>
using namespace std;
int main()
{
unsigned int n,m,i,j,mx,mn,X;
cin>>n;
int a[n],b[9]={0};
for(i=0;i<n;i++)
cin>>a[i];
mx=a[0];
mn=a[0];
for(i=0;i<n;i++)
{
if(a[i]>mx)
mx=a[i];
if(a[i]<mn)
mn=a[i];
}
while(mx!=0)
{
X=mx%10;
b[X]=1;
mx=mx/10;
}
while(mn!=0)
{
X=mn%10;
b[X]=1;
mn=mn/10;
}
X=0;
for(i=9;i>=1;i--)
if(b[i]==1)
X=X*10+i;
cout<<X;
return 0;
}
Explicație: