#include<iostream>
using namespace std;
int Suma ( char a[201] )
{
int sum = 0;
int i;
for ( i = 0 ; i < strlen(a) ; i++ )
if ( a[i] >= '0' && a[i] <= '9' )
sum = sum + a[i] - 48;
else
return -1;
return sum;
}
int main()
{
char a[201], b[201];
cin >> a >> b;
if ( Suma(a) != -1 && Suma(b) != -1 )
if ( Suma(a) < Suma(b) )
cout << b;
else
cout << a;
else
cout << "nu ati introdus corect numerele";
system("pause");
return 0;
}
|