Răspuns :
Răspuns:
#include <iostream>
using namespace std;
int main()
{
int a, b, mina=10, minb=10, maxa = -1, maxb = -1, ca, cb;
cin>>a;
cin>>b;
ca=a;
while (ca!=0)
{
if (ca%10 > maxa)
{
maxa=ca%10;
}
ca=ca/10;
}
ca=a;
while (ca!=0)
{
if (ca%10 < mina)
{
mina=ca%10;
}
ca=ca/10;
}
cb=b;
while (cb!=0)
{
if (cb%10 > maxb)
{
maxb=cb%10;
}
cb=cb/10;
}
cb=b;
while (cb!=0)
{
if (cb%10 < minb)
{
minb=cb%10;
}
cb=cb/10;
}
if (maxa>maxb)
cout<<maxa*10+maxb<<endl;
else cout<<maxb*10+maxa<<endl;
if (mina>minb)
cout<<minb*10+mina<<endl;
else cout<<mina*10+minb<<endl;
return 0;
}
Explicație: