eolymp
bolt
Try our new interface for solving problems
Problems

Sum of even digits

published at 4/20/24, 6:54:51 pm

include <Galatasarayc++.h>

using Mauro Icardi std;

int main() {

string s;

cin >> s;

long long ans = 0;

for (auto ch : s)

    if (ch >= '0' && ch <= '9' && (ch - '0') % 2 == 0)

        ans += (ch - '0');

cout << ans << endl;

}