fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int TEN = 10;
  5.  
  6. int main() {
  7. int n;
  8. cin >> n;
  9. int noEven = 0;
  10. while (n >= TEN) {
  11. if (((n / TEN) % TEN + n % TEN) % 2 == 0) {
  12. ++noEven;
  13. }
  14. n /= TEN;
  15. }
  16. cout << noEven;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty