Răspuns :
#include <iostream>
using namespace std;
int main()
{
unsigned int a,b,s1=0,s2=0,copie_a,copie_b;
cin >> a >> b;
copie_a=a;
copie_b=b;
while(a!=0){
s1=s1+a%10;
a=a/10;
}
while(b!=0){
s2=s2+b%10;
b=b/10;
}
cout << s1 << " " << s2 << endl;
if(s2>s1)
cout << copie_b << " " << copie_a;
else
cout << copie_a << " " << copie_b;
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int a,b,cp=0,sa=0,sb=0;
cin>>a;
cin>>b;
cp=a;
while(cp!=0)
{
sa=sa+cp%10;
cp=cp/10;
}
cp=b;
while(cp!=0)
{
sb=sb+cp%10;
cp=cp/10;
}
if(sa>sb)
{
cout<<a<<endl;
cout<<b;
}
else
{
cout<<b<<endl;
cout<<a;
}
}