Advertisement
STANAANDREY

cnt_cifev rec

Mar 3rd, 2020
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int cnt(int x)
  5. {
  6.     if (!x)
  7.         return 0;
  8.     if ((x % 10) % 2 == 0)
  9.         return cnt(x / 10) + 1;
  10.     return cnt(x / 10);
  11. }
  12.  
  13. int main()
  14. {
  15.     int x;
  16.     cin >> x;
  17.     cout << cnt(x);
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement