Advertisement
Infiniti_Inter

89 1 (7)

May 14th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9. bool even(int k)
  10. {
  11.     return k % 2 == 0 ? true : false;
  12. }
  13. int main()
  14. {
  15.     int n;
  16.     cin >> n;
  17.     vector<int> a(n);
  18.     for (int i = 0; i < n; ++i)
  19.     {
  20.         cin >> a[i];
  21.     }
  22.     cout << count_if(a.begin(), a.end(), even);
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement