Advertisement
Josif_tepe

Untitled

Oct 15th, 2021
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace  std;
  4. int n;
  5. int izbroj_parni(int niza[], int i) {
  6.     if(i == n) {
  7.         return 0;
  8.     }
  9.     if(niza[i] % 2 == 0) {
  10.         return izbroj_parni(niza, i + 1) + 1;
  11.     }
  12.     else {
  13.         return izbroj_parni(niza, i + 1);
  14.     }
  15. }
  16. int main() {
  17.    
  18.     cin >> n;
  19.     int niza[n];
  20.     for(int i = 0; i < n; i++) {
  21.         cin >> niza[i];
  22.     }
  23.     cout << izbroj_parni(niza, 0) << endl;
  24. }
  25. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement