👤

Va rog mult! Am nevoie neapărat!!!

Se citeste un sir cu n numere intregi.
Sa se afle cate dintre acestea sunt pare si pozitive.

ex. n=6 si 23 , -450, -55, 2003, -7, 22 => k=1
n=4 si 0, 0, 0, 0 => k=4
n=3 si -45, 89, -12 => k =0​


Răspuns :

Răspuns:

#include <iostream>

using namespace std;

int main()

{

   int n = 0, x = 0, contor = 0;

   cin >> n;

   for( int i = 0; i < n; ++i )

   {

       cin >> x;

       if( x >= 0 && x % 2 == 0 )

           ++contor;

   }

   cout << contor;

   return 0;

}

Explicație: