Răspuns :
#include <iostream>
using namespace std;
int main()
{
int x, cmin, cmax;
cin >> x; cmin = cmax = x%10;
while (x > 9)
{ cmin = ((cmin>x%10)?x%10:cmin); cmax = ((cmax<x%10)?x%10:cmax); x /= 10;}
cout << cmin + cmax;
}
using namespace std;
int main()
{
int x, cmin, cmax;
cin >> x; cmin = cmax = x%10;
while (x > 9)
{ cmin = ((cmin>x%10)?x%10:cmin); cmax = ((cmax<x%10)?x%10:cmax); x /= 10;}
cout << cmin + cmax;
}
#include <iostream>
using namespace std;
int n,cif,maxx=-1,minn=10;
int main()
{
cin>>n;
if(n==0) {cout<<0; return 0;}
while(n)
{
cif=n%10;
if(cif>maxx) maxx=cif;
if(cif<minn) minn=cif;
n=n/10;
}
cout<<maxx+minn;
return 0;
}
using namespace std;
int n,cif,maxx=-1,minn=10;
int main()
{
cin>>n;
if(n==0) {cout<<0; return 0;}
while(n)
{
cif=n%10;
if(cif>maxx) maxx=cif;
if(cif<minn) minn=cif;
n=n/10;
}
cout<<maxx+minn;
return 0;
}