Untitled
#include <iostream> #include <cmath> using namespace std; int main() { int a,ne_chet = 0; cin >> a; int copy_a = a; int len_a = 0; while (copy_a != 0) { copy_a /= 10; len_a += 1; } int chet = 0; for (int i = len_a; i != 0; i--) { if ((a % 10) % 2 == 0) { chet += 1; } else { ne_chet += 1; } a /= 10; }cout << chet << " " << ne_chet; }