Răspuns:
x,nrp, nri intregi
citeste x
nrp<-0;
nri<-0;
cat timp x!=0 executa
{
daca x%2=0 atunci nrp<-nrp+1
altfel nri<-nri+1
citeste x
}
scrie nrp, nri
C++
#include <iostream>
using namespace std;
int main()
{
int x,nrp,nri;
cin>>x;
nrp=0;
nri=0;
while(x!=0)
{
if(x%2==0) nrp++;
else nri++;
cin>>x;
}
cout<<nrp<<" "<<nri;
return 0;
}