Răspuns:
#include <iostream>
using namespace std;
int a, b, cpya, cpyb, suma;
int main()
{
cin >> a >> b;
cpya = a / 1000;
cpyb = b / 1000;
cout << cpya % 10 + cpyb % 10 + (cpya / 10) % 10 + (cpyb / 10) % 10 << '\n';
while(a >= 100)
{
suma += a % 10;
suma += b % 10;
a /= 10;
b /= 10;
}
cout << suma;
return 0;
}
Explicație: