Bekzhan

School 2012 1-st tour A

Nov 20th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. int ans(int n)
  7. {
  8.     int q = 0;
  9.  
  10.     while (n)
  11.         {
  12.             q += (n % 2 == 0);
  13.  
  14.             n /= 10;
  15.         }
  16.  
  17.     return q;
  18. }
  19.  
  20. int main()
  21. {
  22.     freopen("input.txt", "r", stdin);
  23.     freopen("output.txt", "w", stdout);
  24.  
  25.     int n;
  26.  
  27.     cin >> n;
  28.  
  29.     cout << ans(n);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment