Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int x, even_sum = 0;
- int reversed_num = 0;
- cin >> x;
- while (x != 0) {
- int last_digit = x % 10;
- if (!(last_digit & 1)) {
- even_sum += last_digit;
- }
- reversed_num = reversed_num * 10 + last_digit;
- x /= 10;
- }
- cout << reversed_num << " " << even_sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement