Advertisement
Josif_tepe

Untitled

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